summaryrefslogtreecommitdiff
path: root/misc/xtail/patches/patch-ab
blob: fdac624b88f753a996239406c2bd4a5dc085a1bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
$NetBSD: patch-ab,v 1.2 2006/01/03 15:56:54 joerg Exp $

--- miscfuncs.c.orig	2000-06-05 07:13:22.000000000 +0000
+++ miscfuncs.c
@@ -7,6 +7,7 @@
 #include <string.h>
 #include <ctype.h>
 #include <fcntl.h>
+#include <limits.h>
 #include <errno.h>
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
@@ -65,7 +66,11 @@ int scan_directory(const char *dirname)
     char *basename;
     struct stat sbuf;
     DIR *dirp;
+#ifdef NAME_MAX
+    static char pathname[NAME_MAX];
+#else
     static char pathname[MAXNAMLEN];
+#endif
 
     Dprintf(stderr, ">>> scanning directory '%s'\n", dirname);
     if ((dirp = opendir(dirname)) == NULL)
@@ -281,7 +286,7 @@ VOID *safe_malloc(size_t n)
 {
 	VOID *p;
 	if ((p = malloc(n)) == NULL) {
-		fprintf(stderr, "%s: malloc(%d) failed\n", Progname, n);
+		fprintf(stderr, "%s: malloc(%ld) failed\n", Progname, (long)n);
 		exit(2);
 	}
 	return p;
@@ -291,7 +296,7 @@ VOID *safe_realloc(VOID *p, size_t n)
 {
 	VOID *p1;
 	if ((p1 = realloc(p, n)) == NULL) {
-		fprintf(stderr, "%s: realloc(%d) failed\n", Progname, n);
+		fprintf(stderr, "%s: realloc(%ld) failed\n", Progname, (long)n);
 		exit(2);
 	}
 	return p1;