1 diff -ur util-linux-2.12r/fdisk/cfdisk.c util-linux-2.12r-patched/fdisk/cfdisk.c
2 --- util-linux-2.12r/fdisk/cfdisk.c 2005-09-09 16:44:57.000000000 -0500
3 +++ util-linux-2.12r-patched/fdisk/cfdisk.c 2006-12-04 23:21:09.646235820 -0600
5 /* Some libc's have their own basename() */
7 my_basename(char *devname) {
8 - char *s = rindex(devname, '/');
9 + char *s = strrchr(devname, '/');
10 return s ? s+1 : devname;
13 diff -ur util-linux-2.12r/fdisk/fdiskbsdlabel.c util-linux-2.12r-patched/fdisk/fdiskbsdlabel.c
14 --- util-linux-2.12r/fdisk/fdiskbsdlabel.c 2003-07-13 16:12:47.000000000 -0500
15 +++ util-linux-2.12r-patched/fdisk/fdiskbsdlabel.c 2006-12-04 23:21:09.646235820 -0600
18 /* We need a backup of the disklabel (xbsd_dlabel might have changed). */
19 d = &disklabelbuffer[BSD_LABELSECTOR * SECTOR_SIZE];
20 - bcopy (d, &dl, sizeof (struct xbsd_disklabel));
21 + memcpy (&dl, d, sizeof (struct xbsd_disklabel));
23 /* The disklabel will be overwritten by 0's from bootxx anyway */
24 - bzero (d, sizeof (struct xbsd_disklabel));
25 + memset (d, 0, sizeof (struct xbsd_disklabel));
27 snprintf (path, sizeof(path), "%s/boot%s", bootdir, dkbasename);
28 if (!xbsd_get_bootstrap (path, &disklabelbuffer[xbsd_dlabel.d_secsize],
30 exit ( EXIT_FAILURE );
33 - bcopy (&dl, d, sizeof (struct xbsd_disklabel));
34 + memcpy (d, &dl, sizeof (struct xbsd_disklabel));
36 #if defined (__powerpc__) || defined (__hppa__)
41 get_geometry (fd, &g);
42 - bzero (d, sizeof (struct xbsd_disklabel));
43 + memset (d, 0, sizeof (struct xbsd_disklabel));
45 d -> d_magic = BSD_DISKMAGIC;
48 if (BSD_BBSIZE != read (fd, disklabelbuffer, BSD_BBSIZE))
49 fatal (unable_to_read);
51 - bcopy (&disklabelbuffer[BSD_LABELSECTOR * SECTOR_SIZE + BSD_LABELOFFSET],
52 - d, sizeof (struct xbsd_disklabel));
53 + memcpy (d, &disklabelbuffer[BSD_LABELSECTOR * SECTOR_SIZE + BSD_LABELOFFSET],
54 + sizeof (struct xbsd_disklabel));
56 if (d -> d_magic != BSD_DISKMAGIC || d -> d_magic2 != BSD_DISKMAGIC)
59 /* This is necessary if we want to write the bootstrap later,
60 otherwise we'd write the old disklabel with the bootstrap.
62 - bcopy (d, &disklabelbuffer[BSD_LABELSECTOR * SECTOR_SIZE + BSD_LABELOFFSET],
63 + memcpy (&disklabelbuffer[BSD_LABELSECTOR * SECTOR_SIZE + BSD_LABELOFFSET], d,
64 sizeof (struct xbsd_disklabel));
66 #if defined (__alpha__) && BSD_LABELSECTOR == 0
67 diff -ur util-linux-2.12r/fdisk/sfdisk.c util-linux-2.12r-patched/fdisk/sfdisk.c
68 --- util-linux-2.12r/fdisk/sfdisk.c 2005-01-04 16:31:57.000000000 -0600
69 +++ util-linux-2.12r-patched/fdisk/sfdisk.c 2006-12-04 23:21:09.650236137 -0600
70 @@ -1730,12 +1730,12 @@
74 - if (!(lp = index(lp, '\n')))
75 + if (!(lp = strchr(lp, '\n')))
76 fatal(_("long or incomplete input line - quitting\n"));
79 /* remove comments, if any */
80 - if ((lp = index(line+2, '#')) != 0)
81 + if ((lp = strchr(line+2, '#')) != 0)
84 /* recognize a few commands - to be expanded */
88 /* dump style? - then bad input is fatal */
89 - if ((ip = index(line+2, ':')) != 0) {
90 + if ((ip = strchr(line+2, ':')) != 0) {
97 fatal(_("no command?\n"));
98 - if ((progn = rindex(argv[0], '/')) == NULL)
99 + if ((progn = strrchr(argv[0], '/')) == NULL)
103 diff -ur util-linux-2.12r/login-utils/login.c util-linux-2.12r-patched/login-utils/login.c
104 --- util-linux-2.12r/login-utils/login.c 2004-12-04 20:37:12.000000000 -0600
105 +++ util-linux-2.12r-patched/login-utils/login.c 2006-12-04 23:21:09.650236137 -0600
107 #include <sys/file.h>
110 -#define index strchr
111 -#define rindex strrchr
112 #include <sys/ioctl.h>
113 #include <sys/wait.h>
115 @@ -1192,7 +1190,7 @@
116 childArgv[childArgc++] = buff;
119 - xstrncpy(tbuf + 1, ((p = rindex(pwd->pw_shell, '/')) ?
120 + xstrncpy(tbuf + 1, ((p = strrchr(pwd->pw_shell, '/')) ?
121 p + 1 : pwd->pw_shell),
124 diff -ur util-linux-2.12r/login-utils/passwd.c util-linux-2.12r-patched/login-utils/passwd.c
125 --- util-linux-2.12r/login-utils/passwd.c 2002-03-08 17:00:11.000000000 -0600
126 +++ util-linux-2.12r-patched/login-utils/passwd.c 2006-12-04 23:21:09.650236137 -0600
128 if ( c-gecos && (g = (char *)malloc (c-gecos+1)) ) {
129 strncpy (g, gecos, c-gecos);
131 - while ( (c=rindex(g, ' ')) ) {
132 + while ( (c=strrchr(g, ' ')) ) {
133 if ( !check_passwd_string(passwd, c+1) ) {
134 printf(_("Please don't use something like your realname as password!\n"));
136 diff -ur util-linux-2.12r/login-utils/vipw.c util-linux-2.12r-patched/login-utils/vipw.c
137 --- util-linux-2.12r/login-utils/vipw.c 2004-03-04 15:54:44.000000000 -0600
138 +++ util-linux-2.12r-patched/login-utils/vipw.c 2006-12-04 23:21:09.650236137 -0600
142 bzero(tmp_file, FILENAMELEN);
143 - progname = (rindex(argv[0], '/')) ? rindex(argv[0], '/') + 1 : argv[0];
144 + progname = (strrchr(argv[0], '/')) ? strrchr(argv[0], '/') + 1 : argv[0];
145 if (!strcmp(progname, "vigr")) {
147 xstrncpy(orig_file, GROUP_FILE, sizeof(orig_file));
148 diff -ur util-linux-2.12r/login-utils/wall.c util-linux-2.12r-patched/login-utils/wall.c
149 --- util-linux-2.12r/login-utils/wall.c 2002-03-08 17:00:19.000000000 -0600
150 +++ util-linux-2.12r-patched/login-utils/wall.c 2006-12-04 23:21:09.650236137 -0600
155 - p = rindex(progname, '/');
156 + p = strrchr(progname, '/');
160 diff -ur util-linux-2.12r/misc-utils/logger.c util-linux-2.12r-patched/misc-utils/logger.c
161 --- util-linux-2.12r/misc-utils/logger.c 2004-09-06 16:13:49.000000000 -0500
162 +++ util-linux-2.12r-patched/misc-utils/logger.c 2006-12-04 23:21:09.650236137 -0600
167 - bcopy(*argv++, p, len);
168 + memcpy(p, *argv++, len);
172 diff -ur util-linux-2.12r/misc-utils/whereis.c util-linux-2.12r-patched/misc-utils/whereis.c
173 --- util-linux-2.12r/misc-utils/whereis.c 2001-03-15 04:09:58.000000000 -0600
174 +++ util-linux-2.12r-patched/misc-utils/whereis.c 2006-12-04 23:21:09.650236137 -0600
175 @@ -323,14 +323,14 @@
179 - dd = index(dir, '*');
180 + dd = strchr(dir, '*');
185 if (l < sizeof(dirbuf)) { /* refuse excessively long names */
186 strcpy (dirbuf, dir);
187 - d = index(dirbuf, '*');
188 + d = strchr(dirbuf, '*');
190 dirp = opendir(dirbuf);
192 diff -ur util-linux-2.12r/mount/mntent.c util-linux-2.12r-patched/mount/mntent.c
193 --- util-linux-2.12r/mount/mntent.c 2004-10-13 15:57:34.000000000 -0500
194 +++ util-linux-2.12r-patched/mount/mntent.c 2006-12-04 23:21:09.650236137 -0600
198 mfp->mntent_lineno++;
199 - s = index (buf, '\n');
200 + s = strchr (buf, '\n');
202 /* Missing final newline? Otherwise extremely */
203 /* long line - assume file was corrupted */
205 fprintf(stderr, _("[mntent]: warning: no final "
206 "newline at the end of %s\n"),
208 - s = index (buf, 0);
209 + s = strchr (buf, 0);
211 mfp->mntent_errs = 1;
213 diff -ur util-linux-2.12r/mount/mount.c util-linux-2.12r-patched/mount/mount.c
214 --- util-linux-2.12r/mount/mount.c 2004-12-21 16:00:36.000000000 -0600
215 +++ util-linux-2.12r-patched/mount/mount.c 2006-12-04 23:21:09.654236454 -0600
216 @@ -488,11 +488,11 @@
218 /* Accept a comma-separated list of types, and try them one by one */
219 /* A list like "nonfs,.." indicates types not to use */
220 - if (*types && strncmp(*types, "no", 2) && index(*types,',')) {
221 + if (*types && strncmp(*types, "no", 2) && strchr(*types,',')) {
222 char *t = strdup(*types);
225 - while((p = index(t,',')) != NULL) {
226 + while((p = strchr(t,',')) != NULL) {
228 args.type = *types = t;
229 if(do_mount_syscall (&args) == 0)
230 diff -ur util-linux-2.12r/mount/mount_by_label.c util-linux-2.12r-patched/mount/mount_by_label.c
231 --- util-linux-2.12r/mount/mount_by_label.c 2004-12-21 17:15:33.000000000 -0600
232 +++ util-linux-2.12r-patched/mount/mount_by_label.c 2006-12-04 23:21:09.654236454 -0600
234 fseek(procpt, 0, SEEK_SET);
236 while (fgets(line, sizeof(line), procpt)) {
237 - if (!index(line, '\n'))
238 + if (!strchr(line, '\n'))
241 if (sscanf (line, " %d %d %d %[^\n ]",
242 diff -ur util-linux-2.12r/mount/sundries.c util-linux-2.12r-patched/mount/sundries.c
243 --- util-linux-2.12r/mount/sundries.c 2004-12-21 13:12:31.000000000 -0600
244 +++ util-linux-2.12r-patched/mount/sundries.c 2006-12-04 23:21:09.654236454 -0600
246 if (strncmp(p, type, len) == 0 &&
247 (p[len] == 0 || p[len] == ','))
254 diff -ur util-linux-2.12r/mount/umount.c util-linux-2.12r-patched/mount/umount.c
255 --- util-linux-2.12r/mount/umount.c 2005-09-10 13:07:38.000000000 -0500
256 +++ util-linux-2.12r-patched/mount/umount.c 2006-12-04 23:21:09.654236454 -0600
260 /* Do not complain about remote NFS mount points */
261 - if (errno == ENOENT && index(spec, ':'))
262 + if (errno == ENOENT && strchr(spec, ':'))
266 diff -ur util-linux-2.12r/text-utils/colcrt.c util-linux-2.12r-patched/text-utils/colcrt.c
267 --- util-linux-2.12r/text-utils/colcrt.c 2001-03-15 04:09:59.000000000 -0600
268 +++ util-linux-2.12r-patched/text-utils/colcrt.c 2006-12-04 23:23:45.614600041 -0600
273 - bcopy(page[ol], page, (267 - ol) * 132 * sizeof(wchar_t));
274 - bzero(page[267- ol], ol * 132 * sizeof(wchar_t));
275 + memcpy(page, page[ol], (267 - ol) * 132 * sizeof(wchar_t));
276 + memset(page[267- ol], 0, ol * 132 * sizeof(wchar_t));
280 diff -ur util-linux-2.12r/text-utils/display.c util-linux-2.12r-patched/text-utils/display.c
281 --- util-linux-2.12r/text-utils/display.c 2002-03-08 17:05:39.000000000 -0600
282 +++ util-linux-2.12r-patched/text-utils/display.c 2006-12-04 23:24:32.478315487 -0600
286 for (p1 = pr->fmt; *p1 != '%'; ++p1);
287 - for (p2 = ++p1; *p1 && index(spec, *p1); ++p1);
288 + for (p2 = ++p1; *p1 && strchr(spec, *p1); ++p1);
289 while ((*p2++ = *p1++) != 0) ;
292 diff -ur util-linux-2.12r/text-utils/parse.c util-linux-2.12r-patched/text-utils/parse.c
293 --- util-linux-2.12r/text-utils/parse.c 2002-03-08 17:07:00.000000000 -0600
294 +++ util-linux-2.12r-patched/text-utils/parse.c 2006-12-04 23:24:19.913319294 -0600
298 while (fgets(buf, sizeof(buf), fp)) {
299 - if ((p = index(buf, '\n')) == NULL) {
300 + if ((p = strchr(buf, '\n')) == NULL) {
301 (void)fprintf(stderr, _("hexdump: line too long.\n"));
302 while ((ch = getchar()) != '\n' && ch != EOF);
305 * skip any special chars -- save precision in
306 * case it's a %s format.
308 - while (index(spec + 1, *++fmt));
309 + while (strchr(spec + 1, *++fmt));
310 if (*fmt == '.' && isdigit((unsigned char)*++fmt)) {
312 while (isdigit((unsigned char)*++fmt));
313 @@ -244,10 +244,10 @@
316 /* skip to conversion character */
317 - for (++p1; index(spec, *p1); ++p1);
318 + for (++p1; strchr(spec, *p1); ++p1);
320 /* skip any special chars, field width */
321 - while (index(spec + 1, *++p1));
322 + while (strchr(spec + 1, *++p1));
324 isdigit((unsigned char)*++p1)) {