freebsd-ports/devel/p5-PPerl/files/patch-main.c
Rong-En Fan 19cbb974d6 - Fix test on amd64
Note that it still fails due to the multiuser patch. However, I think
  this PR already improves PPerl on amd64 a lot. So, I decide to commit
  it first.
- Correct CFLAGS passed to cc (patch-Makefile.PL)

These patches were sent to the author via CPAN RT.

PR:		ports/103282
Submitted by:	Vivek Khera <vivek at khera.org>
2006-09-18 13:18:55 +00:00

44 lines
1.4 KiB
C

--- main.c.orig Wed Mar 3 01:06:15 2004
+++ main.c Fri Sep 15 16:48:22 2006
@@ -105,11 +105,11 @@
newval = atoi(pArg);
if (newval > 0) prefork = newval;
}
- else if (!strncmp(pArg, "--logfile", 7) ) {
+ else if (!strncmp(pArg, "--logfile", 9) ) {
int newval;
char *filename;
- if (pArg[7] == '=') /* --logfile=.... */
- pArg += 13;
+ if (pArg[9] == '=') /* --logfile=.... */
+ pArg += 10;
else
pArg = argv[++i];
@@ -223,6 +223,8 @@
/* strict C compilers can't/won't do char foo[variant]; */
char *fullpath = my_malloc(path_max);
int i = 0;
+ char euid[sizeof(uid_t)+10+2];
+ sprintf(euid, "_%d", geteuid());
if (realpath(scriptname, fullpath) == NULL) {
perror("pperl: resolving full pathname to script failed");
@@ -230,7 +232,7 @@
}
Dx(Debug("realpath returned: %s\n", fullpath));
/* Ugh. I am a terrible C programmer! */
- sockname = my_malloc(strlen(P_tmpdir) + strlen(fullpath) + 3);
+ sockname = my_malloc(strlen(P_tmpdir) + strlen(fullpath) + 3 + strlen(euid));
save = sockname;
sprintf(sockname, "%s/", P_tmpdir);
sockname += strlen(P_tmpdir) + 1;
@@ -246,7 +248,7 @@
}
sockname++; i++;
}
- *sockname = '\0';
+ strcat(sockname, euid);
free(fullpath);
return save;
}