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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
|
diff -r -u findutils-4.1.orig/find/defs.h findutils-4.1/find/defs.h
--- findutils-4.1.orig/find/defs.h Wed Nov 2 14:59:15 1994
+++ findutils-4.1/find/defs.h Fri Jul 30 21:07:29 1999
@@ -301,7 +301,7 @@
boolean mark_stat P_((struct predicate *tree));
/* util.c */
-char *basename P_((char *fname));
+char *basename P_((const char *fname));
struct predicate *get_new_pred P_((void));
struct predicate *get_new_pred_chk_op P_((void));
struct predicate *insert_primary P_((boolean (*pred_func )()));
diff -r -u findutils-4.1.orig/find/fstype.c findutils-4.1/find/fstype.c
--- findutils-4.1.orig/find/fstype.c Thu Nov 3 10:33:48 1994
+++ findutils-4.1/find/fstype.c Fri Jul 30 21:08:54 1999
@@ -21,6 +21,7 @@
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <string.h>
#include "defs.h"
#include "modetype.h"
#include <errno.h>
@@ -29,9 +30,6 @@
#else
extern int errno;
#endif
-
-char *strdup ();
-char *strstr ();
static char *filesystem_type_uncached P_((char *path, char *relpath, struct stat *statp));
static int xatoi P_((char *cp));
diff -r -u findutils-4.1.orig/find/parser.c findutils-4.1/find/parser.c
--- findutils-4.1.orig/find/parser.c Wed Nov 2 14:59:19 1994
+++ findutils-4.1/find/parser.c Fri Jul 30 21:08:54 1999
@@ -18,6 +18,7 @@
#include <config.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <pwd.h>
@@ -52,7 +53,6 @@
#define lstat stat
#endif
-char *strstr ();
int lstat ();
int stat ();
#ifndef atol /* for Linux */
diff -r -u findutils-4.1.orig/find/pred.c findutils-4.1/find/pred.c
--- findutils-4.1.orig/find/pred.c Wed Nov 2 14:59:23 1994
+++ findutils-4.1/find/pred.c Fri Jul 30 21:08:54 1999
@@ -15,6 +15,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+#define _GNU_SOURCE
+
#include <config.h>
#include <sys/types.h>
#include <sys/stat.h>
diff -r -u findutils-4.1.orig/find/util.c findutils-4.1/find/util.c
--- findutils-4.1.orig/find/util.c Wed Oct 19 23:49:47 1994
+++ findutils-4.1/find/util.c Fri Jul 30 21:07:29 1999
@@ -26,7 +26,7 @@
char *
basename (fname)
- char *fname;
+ const char *fname;
{
char *p;
diff -r -u findutils-4.1.orig/lib/getline.c findutils-4.1/lib/getline.c
--- findutils-4.1.orig/lib/getline.c Fri Nov 4 09:16:50 1994
+++ findutils-4.1/lib/getline.c Fri Jul 30 21:08:54 1999
@@ -116,7 +116,7 @@
return ret;
}
-int
+ssize_t
getline (lineptr, n, stream)
char **lineptr;
size_t *n;
diff -r -u findutils-4.1.orig/lib/nextelem.c findutils-4.1/lib/nextelem.c
--- findutils-4.1.orig/lib/nextelem.c Tue Sep 27 08:02:45 1994
+++ findutils-4.1/lib/nextelem.c Fri Jul 30 21:09:06 1999
@@ -32,9 +32,6 @@
#endif
#endif
-char *strdup ();
-void free ();
-
/* Return the next element of a colon-separated path.
A null entry in the path is equivalent to "." (the current directory).
diff -r -u findutils-4.1.orig/lib/savedir.c findutils-4.1/lib/savedir.c
--- findutils-4.1.orig/lib/savedir.c Fri Oct 7 12:21:34 1994
+++ findutils-4.1/lib/savedir.c Fri Jul 30 21:09:06 1999
@@ -57,12 +57,11 @@
#else
char *malloc ();
char *realloc ();
+char *stpcpy ();
#endif
#ifndef NULL
#define NULL 0
#endif
-
-char *stpcpy ();
/* Return a freshly allocated string containing the filenames
in directory DIR, separated by '\0' characters;
diff -r -u findutils-4.1.orig/locate/Makefile.in findutils-4.1/locate/Makefile.in
--- findutils-4.1.orig/locate/Makefile.in Sat Nov 5 08:44:08 1994
+++ findutils-4.1/locate/Makefile.in Fri Jul 30 21:08:15 1999
@@ -29,7 +29,7 @@
datadir = $(prefix)/share
sysconfdir = $(prefix)/etc
sharedstatedir = $(prefix)/com
-localstatedir = $(prefix)/var
+localstatedir = /var/spool/locate
libdir = $(exec_prefix)/lib
infodir = $(prefix)/info
mandir = $(prefix)/man
diff -r -u findutils-4.1.orig/locate/locate.c findutils-4.1/locate/locate.c
--- findutils-4.1.orig/locate/locate.c Mon Sep 26 17:06:14 1994
+++ findutils-4.1/locate/locate.c Fri Jul 30 21:08:44 1999
@@ -96,7 +96,7 @@
/* Read in a 16-bit int, high byte first (network byte order). */
-static int
+static short
get_short (fp)
FILE *fp;
{
diff -r -u findutils-4.1.orig/locate/updatedb.sh findutils-4.1/locate/updatedb.sh
--- findutils-4.1.orig/locate/updatedb.sh Tue Oct 4 21:24:18 1994
+++ findutils-4.1/locate/updatedb.sh Fri Jul 30 21:10:56 1999
@@ -53,7 +53,7 @@
: ${NETPATHS=}
# Directories to not put in the database, which would otherwise be.
-: ${PRUNEPATHS="/tmp /usr/tmp /var/tmp /afs"}
+: ${PRUNEPATHS="/tmp /usr/tmp /var/tmp /proc /afs"}
# The same, in the form of a regex that find can use.
test -z "$PRUNEREGEX" &&
@@ -69,6 +69,12 @@
: ${TMPDIR=/usr/tmp}
fi
+if test -x /bin/mktemp; then
+ : ${MKTEMP=/bin/mktemp}
+else
+ : ${MKTEMP=/bin/touch}
+fi
+
# The user to search network directories as.
: ${NETUSER=daemon}
@@ -91,6 +97,11 @@
if test $old = no; then
+NEW_LOCATE_DB=`$MKTEMP $LOCATE_DB.n.XXXXXX` || {
+ echo "could not create temporary locate db" >&2
+ exit 1
+}
+
# FIXME figure out how to sort null-terminated strings, and use -print0.
{
if test -n "$SEARCHPATHS"; then
@@ -102,23 +113,27 @@
su $NETUSER -c \
"$find $NETPATHS \\( -type d -regex \"$PRUNEREGEX\" -prune \\) -o -print"
fi
-} | sort -f | $frcode > $LOCATE_DB.n
+} | sort -f | $frcode > $NEW_LOCATE_DB
# To avoid breaking locate while this script is running, put the
# results in a temp file, then rename it atomically.
-if test -s $LOCATE_DB.n; then
- rm -f $LOCATE_DB
- mv $LOCATE_DB.n $LOCATE_DB
+if test -s $NEW_LOCATE_DB; then
+ # try atomic move first; mv may not have -f flag on some systems
+ mv -f $NEW_LOCATE_DB $LOCATE_DB >/dev/null 2>&1 || {
+ # for systems whose mv does not grok -f
+ rm -f $LOCATE_DB
+ mv $NEW_LOCATE_DB $LOCATE_DB
+ }
chmod 644 $LOCATE_DB
else
echo "updatedb: new database would be empty" >&2
- rm -f $LOCATE_DB.n
+ rm -f $NEW_LOCATE_DB
fi
else # old
-bigrams=$TMPDIR/f.bigrams$$
-filelist=$TMPDIR/f.list$$
+bigrams=`$MKTEMP $TMPDIR/f.bigrams$$XXXXXX`
+filelist=`$MKTEMP $TMPDIR/f.list$$XXXXXX`
trap 'rm -f $bigrams $filelist; exit' 1 15
# Alphabetize subdirectories before file entries using tr. James says:
diff -r -u findutils-4.1.orig/xargs/xargs.c findutils-4.1/xargs/xargs.c
--- findutils-4.1.orig/xargs/xargs.c Fri Oct 7 12:21:39 1994
+++ findutils-4.1/xargs/xargs.c Fri Jul 30 21:09:46 1999
@@ -60,9 +60,6 @@
#define memcpy(dest, source, count) (bcopy((source), (dest), (count)))
#endif
-char *strstr ();
-char *strdup ();
-
#ifndef _POSIX_SOURCE
#include <sys/param.h>
#endif
@@ -627,6 +624,7 @@
strncpy (p, arg, len);
p += len;
arg += len;
+ arglen -= len;
if (s)
{
@@ -635,6 +633,7 @@
break;
strcpy (p, linebuf);
arg += rplen;
+ arglen -= rplen;
p += lblen;
}
}
|