diff options
Diffstat (limited to 'sysutils/xdu/patches/patch-aa')
-rw-r--r-- | sysutils/xdu/patches/patch-aa | 50 |
1 files changed, 6 insertions, 44 deletions
diff --git a/sysutils/xdu/patches/patch-aa b/sysutils/xdu/patches/patch-aa index a9bfa9b71c4..5ab96cb614d 100644 --- a/sysutils/xdu/patches/patch-aa +++ b/sysutils/xdu/patches/patch-aa @@ -1,7 +1,7 @@ -$NetBSD: patch-aa,v 1.3 2002/04/05 01:33:25 hubertf Exp $ +$NetBSD: patch-aa,v 1.4 2005/07/12 20:16:00 hubertf Exp $ ---- xdu.c.orig Sun Jun 5 21:29:23 1994 -+++ xdu.c +--- xdu.c.orig 2005-07-11 23:15:31.000000000 +0200 ++++ xdu.c 2005-07-11 23:19:59.000000000 +0200 @@ -19,13 +19,15 @@ * limitation a license to do the foregoing actions under any patents of * the party supplying this software to the X Consortium. @@ -31,53 +31,15 @@ $NetBSD: patch-aa,v 1.3 2002/04/05 01:33:25 hubertf Exp $ np->name = strdup(name); np->size = size; np->num = nnodes; -@@ -232,7 +238,6 @@ - char *filename; - { - char buf[4096]; -- char name[4096]; - int size; - FILE *fp; - -@@ -245,9 +250,12 @@ - } - } - while (fgets(buf,sizeof(buf),fp) != NULL) { -- sscanf(buf, "%d %s\n", &size, name); -- /*printf("%d %s\n", size, name);*/ -- parse_entry(name,size); -+ char *p, *q = NULL; -+ p = strtok_r(buf, " \t", &q); -+ size = atoi(p); -+ p = strtok_r(NULL, "\r\n", &q); -+ /* printf("%d %s\n", size, p); */ -+ parse_entry(p,size); - } - fclose(fp); - } -@@ -290,7 +298,12 @@ - name++; - } - buf[indx] = 0; -- path[arg++] = strdup(buf); -+ path[arg] = strdup(buf); -+ if (path[arg] == NULL) { -+ fprintf(stderr, "Out of memory! (#3)\n"); -+ exit(1); -+ } -+ arg++; - path[arg] = NULL; - - addtree(&top,path,size); -@@ -622,6 +635,7 @@ +@@ -610,6 +616,7 @@ 100.0*topp->size/rootp->size); } -+#ifndef __NetBSD__ ++#if !defined(__NetBSD__) && !defined(SVR4) /* == Solaris etc. */ char * strdup(s) char *s; -@@ -631,10 +645,15 @@ +@@ -619,10 +626,15 @@ n = strlen(s); cp = malloc(n+1); |