summaryrefslogtreecommitdiff
path: root/sysutils/xdu/patches/patch-aa
diff options
context:
space:
mode:
Diffstat (limited to 'sysutils/xdu/patches/patch-aa')
-rw-r--r--sysutils/xdu/patches/patch-aa72
1 files changed, 69 insertions, 3 deletions
diff --git a/sysutils/xdu/patches/patch-aa b/sysutils/xdu/patches/patch-aa
index 150a2de7a6c..a9d59f4e5e5 100644
--- a/sysutils/xdu/patches/patch-aa
+++ b/sysutils/xdu/patches/patch-aa
@@ -1,8 +1,15 @@
-$NetBSD: patch-aa,v 1.1 2000/12/14 01:10:43 hubertf Exp $
+$NetBSD: patch-aa,v 1.2 2001/08/25 16:34:27 hubertf Exp $
---- xdu.c.orig Wed Dec 13 23:18:33 2000
+--- xdu.c.orig Sun Jun 5 21:29:23 1994
+++ xdu.c
-@@ -24,8 +24,8 @@
+@@ -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.
+ */
++#include <assert.h>
+ #include <stdio.h>
++#include <string.h>
+ #include "version.h"
extern char *malloc(), *calloc();
@@ -13,3 +20,62 @@ $NetBSD: patch-aa,v 1.1 2000/12/14 01:10:43 hubertf Exp $
#define MAXPATH 4096 /* max total pathname length */
#define NCOLS 5 /* default number of columns in display */
+@@ -96,6 +98,10 @@
+ struct node *np;
+
+ np = (struct node *)calloc(1,sizeof(struct node));
++ if (np == NULL) {
++ fprintf(stderr, "Out of memory! (#1)\n");
++ exit(1);
++ }
+ 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);
+ }
+@@ -622,6 +630,7 @@
+ 100.0*topp->size/rootp->size);
+ }
+
++#ifndef __NetBSD__
+ char *
+ strdup(s)
+ char *s;
+@@ -631,10 +640,15 @@
+
+ n = strlen(s);
+ cp = malloc(n+1);
++ if (cp == NULL) {
++ fprintf(stderr, "Out of memory! (#2)\n");
++ exit(1);
++ }
+ strcpy(cp,s);
+
+ return cp;
+ }
++#endif /* __NetBSD__ */
+
+ /**************** External Entry Points ****************/
+