Source: qstat
Version: 2.15-2
Severity: important
Tags: patch
Usertags: hurd
User: debian-h...@lists.debian.org
Hello,
Attached is a small patch to fix the GNU/Hurd build by avoiding using PATH_MAX,
since it is not defined.
Thanks!
Index: qstat-2.15/debug.c
===================================================================
--- qstat-2.15.orig/debug.c
+++ qstat-2.15/debug.c
@@ -103,11 +103,15 @@ void malformed_packet(const struct qserv
static unsigned count = 0;
static void _dump_packet(const char* tag, const char* buf, int buflen)
{
- char fn[PATH_MAX] = {0};
- int fd;
- sprintf(fn, "%03u_%s.pkt", count++, tag);
+ char *fn = NULL;
+ int fd, len;
+ len = 3 + 1 + strlen(tag) + 4 + 1;
+ fn = malloc(len);
+ if(!fn) { perror("malloc"); return; }
+ snprintf(fn, len, "%03u_%s.pkt", count++, tag);
fprintf(stderr, "dumping to %s\n", fn);
fd = open(fn, O_WRONLY|O_CREAT|O_EXCL, 0644);
+ free(fn);
if(fd == -1) { perror("open"); return; }
if(write(fd, buf, buflen) == -1)
perror("write");