summaryrefslogtreecommitdiff
path: root/package/util-linux/util-linux-susv3-legacy.patch
blob: 2239119a505563423551873f1fd8a150849c3764 (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
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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
[PATCH] replace susv3 legacy functions with modern equivalents

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
---
 fdisk/cfdisk.c         |    2 +-
 fdisk/fdiskbsdlabel.c  |   16 ++++++++--------
 fdisk/sfdisk.c         |   10 +++++-----
 login-utils/login.c    |    6 +++---
 login-utils/shutdown.c |    2 +-
 login-utils/ttymsg.c   |    2 +-
 login-utils/vipw.c     |    4 ++--
 login-utils/wall.c     |    2 +-
 misc-utils/logger.c    |    2 +-
 misc-utils/namei.c     |    2 +-
 misc-utils/whereis.c   |    4 ++--
 mount/mntent.c         |    4 ++--
 mount/mount.c          |    4 ++--
 mount/mount_by_label.c |    2 +-
 mount/sundries.c       |    2 +-
 mount/umount.c         |    2 +-
 partx/partx.c          |    2 +-
 text-utils/colcrt.c    |    4 ++--
 text-utils/display.c   |    2 +-
 text-utils/parse.c     |    8 ++++----
 20 files changed, 41 insertions(+), 41 deletions(-)

Index: util-linux-2.13-pre7/fdisk/fdiskbsdlabel.c
===================================================================
--- util-linux-2.13-pre7.orig/fdisk/fdiskbsdlabel.c
+++ util-linux-2.13-pre7/fdisk/fdiskbsdlabel.c
@@ -538,10 +538,10 @@
 
   /* We need a backup of the disklabel (xbsd_dlabel might have changed). */
   d = &disklabelbuffer[BSD_LABELSECTOR * SECTOR_SIZE];
-  bcopy (d, &dl, sizeof (struct xbsd_disklabel));
+  memmove (&dl, d, sizeof (struct xbsd_disklabel));
 
   /* The disklabel will be overwritten by 0's from bootxx anyway */
-  bzero (d, sizeof (struct xbsd_disklabel));
+  memset (d, 0, sizeof (struct xbsd_disklabel));
 
   snprintf (path, sizeof(path), "%s/boot%s", bootdir, dkbasename);
   if (!xbsd_get_bootstrap (path, &disklabelbuffer[xbsd_dlabel.d_secsize],
@@ -555,7 +555,7 @@
       exit ( EXIT_FAILURE );
     }
 
-  bcopy (&dl, d, sizeof (struct xbsd_disklabel));
+  memmove (d, &dl, sizeof (struct xbsd_disklabel));
 
 #if defined (__powerpc__) || defined (__hppa__)
   sector = 0;
@@ -657,7 +657,7 @@
 	struct geom g;
 
 	get_geometry (fd, &g);
-	bzero (d, sizeof (struct xbsd_disklabel));
+	memset (d, 0, sizeof (struct xbsd_disklabel));
 
 	d -> d_magic = BSD_DISKMAGIC;
 
@@ -740,8 +740,8 @@
 	if (BSD_BBSIZE != read (fd, disklabelbuffer, BSD_BBSIZE))
 		fatal (unable_to_read);
 
-	bcopy (&disklabelbuffer[BSD_LABELSECTOR * SECTOR_SIZE + BSD_LABELOFFSET],
-	       d, sizeof (struct xbsd_disklabel));
+	memmove (d, &disklabelbuffer[BSD_LABELSECTOR * SECTOR_SIZE + BSD_LABELOFFSET],
+	       sizeof (struct xbsd_disklabel));
 
 	if (d -> d_magic != BSD_DISKMAGIC || d -> d_magic2 != BSD_DISKMAGIC)
 		return 0;
@@ -776,8 +776,8 @@
   /* This is necessary if we want to write the bootstrap later,
      otherwise we'd write the old disklabel with the bootstrap.
   */
-  bcopy (d, &disklabelbuffer[BSD_LABELSECTOR * SECTOR_SIZE + BSD_LABELOFFSET],
-	 sizeof (struct xbsd_disklabel));
+  memmove (&disklabelbuffer[BSD_LABELSECTOR * SECTOR_SIZE + BSD_LABELOFFSET],
+	 d, sizeof (struct xbsd_disklabel));
 
 #if defined (__alpha__) && BSD_LABELSECTOR == 0
   alpha_bootblock_checksum (disklabelbuffer);
Index: util-linux-2.13-pre7/login-utils/ttymsg.c
===================================================================
--- util-linux-2.13-pre7.orig/login-utils/ttymsg.c
+++ util-linux-2.13-pre7/login-utils/ttymsg.c
@@ -111,7 +111,7 @@
 		if (wret >= 0) {
 			left -= wret;
 			if (iov != localiov) {
-				bcopy(iov, localiov,
+				memmove(localiov, iov,
 				    iovcnt * sizeof(struct iovec));
 				iov = localiov;
 			}
Index: util-linux-2.13-pre7/login-utils/vipw.c
===================================================================
--- util-linux-2.13-pre7.orig/login-utils/vipw.c
+++ util-linux-2.13-pre7/login-utils/vipw.c
@@ -313,8 +313,8 @@
 	bindtextdomain(PACKAGE, LOCALEDIR);
 	textdomain(PACKAGE);
 
-	bzero(tmp_file, FILENAMELEN);
-	progname = (rindex(argv[0], '/')) ? rindex(argv[0], '/') + 1 : argv[0];
+	memset(tmp_file, 0, FILENAMELEN);
+	progname = (strrchr(argv[0], '/')) ? strrchr(argv[0], '/') + 1 : argv[0];
 	if (!strcmp(progname, "vigr")) {
 		program = VIGR;
 		xstrncpy(orig_file, GROUP_FILE, sizeof(orig_file));
Index: util-linux-2.13-pre7/misc-utils/logger.c
===================================================================
--- util-linux-2.13-pre7.orig/misc-utils/logger.c
+++ util-linux-2.13-pre7/misc-utils/logger.c
@@ -198,7 +198,7 @@
 			} else {
 				if (p != buf)
 					*p++ = ' ';
-				bcopy(*argv++, p, len);
+				memmove(p, *argv++, len);
 				*(p += len) = '\0';
 			}
 		}
Index: util-linux-2.13-pre7/misc-utils/namei.c
===================================================================
--- util-linux-2.13-pre7.orig/misc-utils/namei.c
+++ util-linux-2.13-pre7/misc-utils/namei.c
@@ -242,7 +242,7 @@
 		 * call namei()
 		 */
 		
-		bzero(sym, BUFSIZ);
+		memset(sym, 0, BUFSIZ);
 		if(readlink(buf, sym, BUFSIZ) == -1){
 		    (void)printf(_(" ? problems reading symlink %s - %s (%d)\n"), buf, ERR);
 		    return;
Index: util-linux-2.13-pre7/text-utils/colcrt.c
===================================================================
--- util-linux-2.13-pre7.orig/text-utils/colcrt.c
+++ util-linux-2.13-pre7/text-utils/colcrt.c
@@ -252,8 +252,8 @@
 		}
 		putwchar('\n');
 	}
-	bcopy(page[ol], page, (267 - ol) * 132 * sizeof(wchar_t));
-	bzero(page[267- ol], ol * 132 * sizeof(wchar_t));
+	memmove(page, page[ol], (267 - ol) * 132 * sizeof(wchar_t));
+	memset(page[267- ol], 0, ol * 132 * sizeof(wchar_t));
 	outline -= ol;
 	outcol = 0;
 	first = 1;
Index: util-linux-2.13-pre7/fdisk/sfdisk.c
===================================================================
--- util-linux-2.13-pre7.orig/fdisk/sfdisk.c
+++ util-linux-2.13-pre7/fdisk/sfdisk.c
@@ -40,7 +40,7 @@
 #include <unistd.h>		/* read, write */
 #include <fcntl.h>		/* O_RDWR */
 #include <errno.h>		/* ERANGE */
-#include <string.h>		/* index() */
+#include <string.h>		/* strchr() */
 #include <ctype.h>
 #include <getopt.h>
 #include <sys/ioctl.h>
@@ -1709,12 +1709,12 @@
 	eof = 1;
 	return RD_EOF;
     }
-    if (!(lp = index(lp, '\n')))
+    if (!(lp = strchr(lp, '\n')))
       fatal(_("long or incomplete input line - quitting\n"));
     *lp = 0;
 
     /* remove comments, if any */
-    if ((lp = index(line+2, '#')) != 0)
+    if ((lp = strchr(line+2, '#')) != 0)
       *lp = 0;
 
     /* recognize a few commands - to be expanded */
@@ -1724,7 +1724,7 @@
     }
 
     /* dump style? - then bad input is fatal */
-    if ((ip = index(line+2, ':')) != 0) {
+    if ((ip = strchr(line+2, ':')) != 0) {
 	struct dumpfld *d;
 
       nxtfld:
@@ -2491,7 +2491,7 @@
 
     if (argc < 1)
       fatal(_("no command?\n"));
-    if ((progn = rindex(argv[0], '/')) == NULL)
+    if ((progn = strrchr(argv[0], '/')) == NULL)
       progn = argv[0];
     else
       progn++;
Index: util-linux-2.13-pre7/login-utils/login.c
===================================================================
--- util-linux-2.13-pre7.orig/login-utils/login.c
+++ util-linux-2.13-pre7/login-utils/login.c
@@ -337,7 +337,7 @@
      */
     gethostname(tbuf, sizeof(tbuf));
     xstrncpy(thishost, tbuf, sizeof(thishost));
-    domain = index(tbuf, '.');
+    domain = strchr(tbuf, '.');
     
     username = tty_name = hostname = NULL;
     fflag = hflag = pflag = 0;
@@ -356,7 +356,7 @@
 	      exit(1);
 	  }
 	  hflag = 1;
-	  if (domain && (p = index(optarg, '.')) &&
+	  if (domain && (p = strchr(optarg, '.')) &&
 	      strcasecmp(p, domain) == 0)
 	    *p = 0;
 
@@ -1101,7 +1101,7 @@
 	childArgv[childArgc++] = buff;
     } else {
 	tbuf[0] = '-';
-	xstrncpy(tbuf + 1, ((p = rindex(pwd->pw_shell, '/')) ?
+	xstrncpy(tbuf + 1, ((p = strrchr(pwd->pw_shell, '/')) ?
 			   p + 1 : pwd->pw_shell),
 		sizeof(tbuf)-1);
 	
Index: util-linux-2.13-pre7/login-utils/shutdown.c
===================================================================
--- util-linux-2.13-pre7.orig/login-utils/shutdown.c
+++ util-linux-2.13-pre7/login-utils/shutdown.c
@@ -279,7 +279,7 @@
 			if (fgets (line, sizeof(line), fp) != NULL &&
 			    strncasecmp (line, "HALT_ACTION", 11) == 0 &&
 			    iswhitespace(line[11])) {
-				p = index(line, '\n');
+				p = strchr(line, '\n');
 				if (p)
 					*p = 0;		/* strip final '\n' */
 				p = line+11;
Index: util-linux-2.13-pre7/misc-utils/whereis.c
===================================================================
--- util-linux-2.13-pre7.orig/misc-utils/whereis.c
+++ util-linux-2.13-pre7/misc-utils/whereis.c
@@ -323,14 +323,14 @@
 	char dirbuf[1024];
 	struct stat statbuf;
 
-	dd = index(dir, '*');
+	dd = strchr(dir, '*');
 	if (!dd)
 		goto noglob;
 
 	l = strlen(dir);
 	if (l < sizeof(dirbuf)) { 	/* refuse excessively long names */
 		strcpy (dirbuf, dir);
-		d = index(dirbuf, '*');
+		d = strchr(dirbuf, '*');
 		*d = 0;
 		dirp = opendir(dirbuf);
 		if (dirp == NULL)
Index: util-linux-2.13-pre7/mount/mntent.c
===================================================================
--- util-linux-2.13-pre7.orig/mount/mntent.c
+++ util-linux-2.13-pre7/mount/mntent.c
@@ -158,7 +158,7 @@
 			return NULL;
 
 		mfp->mntent_lineno++;
-		s = index (buf, '\n');
+		s = strchr (buf, '\n');
 		if (s == NULL) {
 			/* Missing final newline?  Otherwise extremely */
 			/* long line - assume file was corrupted */
@@ -166,7 +166,7 @@
 				fprintf(stderr, _("[mntent]: warning: no final "
 					"newline at the end of %s\n"),
 					mfp->mntent_file);
-				s = index (buf, 0);
+				s = strchr (buf, 0);
 			} else {
 				mfp->mntent_errs = 1;
 				goto err;
Index: util-linux-2.13-pre7/mount/mount.c
===================================================================
--- util-linux-2.13-pre7.orig/mount/mount.c
+++ util-linux-2.13-pre7/mount/mount.c
@@ -488,11 +488,11 @@
 
    /* Accept a comma-separated list of types, and try them one by one */
    /* A list like "nonfs,.." indicates types not to use */
-   if (*types && strncmp(*types, "no", 2) && index(*types,',')) {
+   if (*types && strncmp(*types, "no", 2) && strchr(*types,',')) {
       char *t = strdup(*types);
       char *p;
 
-      while((p = index(t,',')) != NULL) {
+      while((p = strchr(t,',')) != NULL) {
 	 *p = 0;
 	 args.type = *types = t;
 	 if(do_mount_syscall (&args) == 0)
Index: util-linux-2.13-pre7/mount/mount_by_label.c
===================================================================
--- util-linux-2.13-pre7.orig/mount/mount_by_label.c
+++ util-linux-2.13-pre7/mount/mount_by_label.c
@@ -213,7 +213,7 @@
 	    fseek(procpt, 0, SEEK_SET);
 
 	    while (fgets(line, sizeof(line), procpt)) {
-		if (!index(line, '\n'))
+		if (!strchr(line, '\n'))
 			break;
 
 		if (sscanf (line, " %d %d %d %[^\n ]",
Index: util-linux-2.13-pre7/mount/sundries.c
===================================================================
--- util-linux-2.13-pre7.orig/mount/sundries.c
+++ util-linux-2.13-pre7/mount/sundries.c
@@ -138,7 +138,7 @@
 	     if (strncmp(p, type, len) == 0 &&
 		 (p[len] == 0 || p[len] == ','))
 		     return !no;
-	     p = index(p,',');
+	     p = strchr(p,',');
 	     if (!p)
 		     break;
 	     p++;
Index: util-linux-2.13-pre7/mount/umount.c
===================================================================
--- util-linux-2.13-pre7.orig/mount/umount.c
+++ util-linux-2.13-pre7/mount/umount.c
@@ -332,7 +332,7 @@
 			if (res < 0)
 				umnt_err2 = errno;
 			/* Do not complain about remote NFS mount points */
-			if (errno == ENOENT && index(spec, ':'))
+			if (errno == ENOENT && strchr(spec, ':'))
 				umnt_err2 = 0;
 		}
 	}
Index: util-linux-2.13-pre7/partx/partx.c
===================================================================
--- util-linux-2.13-pre7.orig/partx/partx.c
+++ util-linux-2.13-pre7/partx/partx.c
@@ -130,7 +130,7 @@
 	case 'n':
 		p = optarg;
 		lower = atoi(p);
-		p = index(p, '-');
+		p = strchr(p, '-');
 		if (p)
 			upper = atoi(p+1);
 		else
Index: util-linux-2.13-pre7/text-utils/display.c
===================================================================
--- util-linux-2.13-pre7.orig/text-utils/display.c
+++ util-linux-2.13-pre7/text-utils/display.c
@@ -163,7 +163,7 @@
 	pr->cchar[0] = 's';
 	pr->cchar[1] = 0;
 	for (p1 = pr->fmt; *p1 != '%'; ++p1);
-	for (p2 = ++p1; *p1 && index(spec, *p1); ++p1);
+	for (p2 = ++p1; *p1 && strchr(spec, *p1); ++p1);
 	while ((*p2++ = *p1++) != 0) ;
 }
 
Index: util-linux-2.13-pre7/text-utils/parse.c
===================================================================
--- util-linux-2.13-pre7.orig/text-utils/parse.c
+++ util-linux-2.13-pre7/text-utils/parse.c
@@ -64,7 +64,7 @@
 		exit(1);
 	}
 	while (fgets(buf, sizeof(buf), fp)) {
-		if ((p = index(buf, '\n')) == NULL) {
+		if ((p = strchr(buf, '\n')) == NULL) {
 			(void)fprintf(stderr, _("hexdump: line too long.\n"));
 			while ((ch = getchar()) != '\n' && ch != EOF);
 			continue;
@@ -171,7 +171,7 @@
 			 * skip any special chars -- save precision in
 			 * case it's a %s format.
 			 */
-			while (index(spec + 1, *++fmt));
+			while (strchr(spec + 1, *++fmt));
 			if (*fmt == '.' && isdigit((unsigned char)*++fmt)) {
 				prec = atoi(fmt);
 				while (isdigit((unsigned char)*++fmt));
@@ -244,10 +244,10 @@
 			if (fu->bcnt) {
 				sokay = USEBCNT;
 				/* skip to conversion character */
-				for (++p1; index(spec, *p1); ++p1);
+				for (++p1; strchr(spec, *p1); ++p1);
 			} else {
 				/* skip any special chars, field width */
-				while (index(spec + 1, *++p1));
+				while (strchr(spec + 1, *++p1));
 				if (*p1 == '.' &&
 				    isdigit((unsigned char)*++p1)) {
 					sokay = USEPREC;
Index: util-linux-2.13-pre7/fdisk/cfdisk.c
===================================================================
--- util-linux-2.13-pre7.orig/fdisk/cfdisk.c
+++ util-linux-2.13-pre7/fdisk/cfdisk.c
@@ -348,7 +348,7 @@
 /* Some libc's have their own basename() */
 static char *
 my_basename(char *devname) {
-    char *s = rindex(devname, '/');
+    char *s = strrchr(devname, '/');
     return s ? s+1 : devname;
 }
 
Index: util-linux-2.13-pre7/login-utils/wall.c
===================================================================
--- util-linux-2.13-pre7.orig/login-utils/wall.c
+++ util-linux-2.13-pre7/login-utils/wall.c
@@ -87,7 +87,7 @@
         textdomain(PACKAGE);
 
 	progname = argv[0];
-	p = rindex(progname, '/');
+	p = strrchr(progname, '/');
 	if (p)
 	     progname = p+1;