X-Debbugs-CC: [email protected]
Control: tag 747672 patch
Dear Maintainer and debian-hurd list,
This is an old bug report and both burp and the hurd have changed since it was
opened. Currently burp FTBFS because the PATH_MAX macro is undefined in the
hurd. I attach a patch that addresses this issue and with it burp builds.
Do let me know if you have any concerns about this patch.
Best regards,
João
--- burp-3.1.4.orig/src/client/monitor/status_client_ncurses.c
+++ burp-3.1.4/src/client/monitor/status_client_ncurses.c
@@ -1468,15 +1468,24 @@ static pid_t fork_monitor(int *csin, int
int a=0;
char *args[12];
char procpath[32];
- char buf[PATH_MAX];
+ struct stat statbuf;
+ char *buf=NULL;
+ int bufsize=0;
char *monitor_exe;
monitor_exe=get_string(confs[OPT_MONITOR_EXE]);
snprintf(procpath, sizeof(procpath), "/proc/%d/exe", getpid());
if(monitor_exe && is_reg_lstat(monitor_exe)>0)
args[a++]=monitor_exe;
- else if(!readlink_w(procpath, buf, sizeof(buf)))
- args[a++]=(char *)buf;
+ else if(is_lnk_lstat(procpath)>0)
+ {
+ lstat(procpath, &statbuf);
+ bufsize=statbuf.st_size+1;
+ buf=malloc(bufsize);
+ if(!readlink_w(procpath, (char *)buf, bufsize))
+ args[a++]=(char *)buf;
+ free_w(&buf);
+ }
else if(is_reg_lstat(prog_long)>0)
args[a++]=(char *)prog_long;
else
--- burp-3.1.4.orig/src/client/restore.c
+++ burp-3.1.4/src/client/restore.c
@@ -566,12 +566,6 @@ static char *get_restore_style(struct as
return restore_style;
}
-#ifdef HAVE_WIN32
-#ifndef PATH_MAX
- #define PATH_MAX _MAX_PATH
-#endif
-#endif
-
static char *get_restore_desired_dir(
const char *restoreprefix,
struct asfd *asfd,
@@ -592,8 +586,8 @@ static char *get_restore_desired_dir(
}
else
{
- static char d[PATH_MAX];
- if(!getcwd(d, sizeof(d)))
+ char *d=NULL;
+ if(!(d=getcwd(NULL,0)))
{
logw(asfd, cntr,
"Could not get current working directory: %s\n",
@@ -601,7 +595,11 @@ static char *get_restore_desired_dir(
return NULL;
}
if(!(path=prepend_s(d, restoreprefix)))
+ {
+ free_w(&d);
return NULL;
+ }
+ free_w(&d);
}
// Canonicalise the path so that we can protect against symlinks that