2
1

util-linux-remove-deprecated-functions.patch 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  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
  4. @@ -353,7 +353,7 @@
  5. /* Some libc's have their own basename() */
  6. static char *
  7. my_basename(char *devname) {
  8. - char *s = rindex(devname, '/');
  9. + char *s = strrchr(devname, '/');
  10. return s ? s+1 : devname;
  11. }
  12. diff -ur util-linux-2.12r/fdisk/fdiskbsdlabel.c util-linux-2.12r-patched/fdisk/fdiskbsdlabel.c
  13. --- util-linux-2.12r/fdisk/fdiskbsdlabel.c 2003-07-13 16:12:47.000000000 -0500
  14. +++ util-linux-2.12r-patched/fdisk/fdiskbsdlabel.c 2006-12-04 23:21:09.646235820 -0600
  15. @@ -538,10 +538,10 @@
  16. /* We need a backup of the disklabel (xbsd_dlabel might have changed). */
  17. d = &disklabelbuffer[BSD_LABELSECTOR * SECTOR_SIZE];
  18. - bcopy (d, &dl, sizeof (struct xbsd_disklabel));
  19. + memcpy (&dl, d, sizeof (struct xbsd_disklabel));
  20. /* The disklabel will be overwritten by 0's from bootxx anyway */
  21. - bzero (d, sizeof (struct xbsd_disklabel));
  22. + memset (d, 0, sizeof (struct xbsd_disklabel));
  23. snprintf (path, sizeof(path), "%s/boot%s", bootdir, dkbasename);
  24. if (!xbsd_get_bootstrap (path, &disklabelbuffer[xbsd_dlabel.d_secsize],
  25. @@ -555,7 +555,7 @@
  26. exit ( EXIT_FAILURE );
  27. }
  28. - bcopy (&dl, d, sizeof (struct xbsd_disklabel));
  29. + memcpy (d, &dl, sizeof (struct xbsd_disklabel));
  30. #if defined (__powerpc__) || defined (__hppa__)
  31. sector = 0;
  32. @@ -657,7 +657,7 @@
  33. struct geom g;
  34. get_geometry (fd, &g);
  35. - bzero (d, sizeof (struct xbsd_disklabel));
  36. + memset (d, 0, sizeof (struct xbsd_disklabel));
  37. d -> d_magic = BSD_DISKMAGIC;
  38. @@ -740,8 +740,8 @@
  39. if (BSD_BBSIZE != read (fd, disklabelbuffer, BSD_BBSIZE))
  40. fatal (unable_to_read);
  41. - bcopy (&disklabelbuffer[BSD_LABELSECTOR * SECTOR_SIZE + BSD_LABELOFFSET],
  42. - d, sizeof (struct xbsd_disklabel));
  43. + memcpy (d, &disklabelbuffer[BSD_LABELSECTOR * SECTOR_SIZE + BSD_LABELOFFSET],
  44. + sizeof (struct xbsd_disklabel));
  45. if (d -> d_magic != BSD_DISKMAGIC || d -> d_magic2 != BSD_DISKMAGIC)
  46. return 0;
  47. @@ -776,7 +776,7 @@
  48. /* This is necessary if we want to write the bootstrap later,
  49. otherwise we'd write the old disklabel with the bootstrap.
  50. */
  51. - bcopy (d, &disklabelbuffer[BSD_LABELSECTOR * SECTOR_SIZE + BSD_LABELOFFSET],
  52. + memcpy (&disklabelbuffer[BSD_LABELSECTOR * SECTOR_SIZE + BSD_LABELOFFSET], d,
  53. sizeof (struct xbsd_disklabel));
  54. #if defined (__alpha__) && BSD_LABELSECTOR == 0
  55. diff -ur util-linux-2.12r/fdisk/sfdisk.c util-linux-2.12r-patched/fdisk/sfdisk.c
  56. --- util-linux-2.12r/fdisk/sfdisk.c 2005-01-04 16:31:57.000000000 -0600
  57. +++ util-linux-2.12r-patched/fdisk/sfdisk.c 2006-12-04 23:21:09.650236137 -0600
  58. @@ -1730,12 +1730,12 @@
  59. eof = 1;
  60. return RD_EOF;
  61. }
  62. - if (!(lp = index(lp, '\n')))
  63. + if (!(lp = strchr(lp, '\n')))
  64. fatal(_("long or incomplete input line - quitting\n"));
  65. *lp = 0;
  66. /* remove comments, if any */
  67. - if ((lp = index(line+2, '#')) != 0)
  68. + if ((lp = strchr(line+2, '#')) != 0)
  69. *lp = 0;
  70. /* recognize a few commands - to be expanded */
  71. @@ -1745,7 +1745,7 @@
  72. }
  73. /* dump style? - then bad input is fatal */
  74. - if ((ip = index(line+2, ':')) != 0) {
  75. + if ((ip = strchr(line+2, ':')) != 0) {
  76. struct dumpfld *d;
  77. nxtfld:
  78. @@ -2514,7 +2514,7 @@
  79. if (argc < 1)
  80. fatal(_("no command?\n"));
  81. - if ((progn = rindex(argv[0], '/')) == NULL)
  82. + if ((progn = strrchr(argv[0], '/')) == NULL)
  83. progn = argv[0];
  84. else
  85. progn++;
  86. diff -ur util-linux-2.12r/login-utils/login.c util-linux-2.12r-patched/login-utils/login.c
  87. --- util-linux-2.12r/login-utils/login.c 2004-12-04 20:37:12.000000000 -0600
  88. +++ util-linux-2.12r-patched/login-utils/login.c 2006-12-04 23:21:09.650236137 -0600
  89. @@ -97,8 +97,6 @@
  90. #include <sys/file.h>
  91. #include <termios.h>
  92. #include <string.h>
  93. -#define index strchr
  94. -#define rindex strrchr
  95. #include <sys/ioctl.h>
  96. #include <sys/wait.h>
  97. #include <signal.h>
  98. @@ -1192,7 +1190,7 @@
  99. childArgv[childArgc++] = buff;
  100. } else {
  101. tbuf[0] = '-';
  102. - xstrncpy(tbuf + 1, ((p = rindex(pwd->pw_shell, '/')) ?
  103. + xstrncpy(tbuf + 1, ((p = strrchr(pwd->pw_shell, '/')) ?
  104. p + 1 : pwd->pw_shell),
  105. sizeof(tbuf)-1);
  106. diff -ur util-linux-2.12r/login-utils/passwd.c util-linux-2.12r-patched/login-utils/passwd.c
  107. --- util-linux-2.12r/login-utils/passwd.c 2002-03-08 17:00:11.000000000 -0600
  108. +++ util-linux-2.12r-patched/login-utils/passwd.c 2006-12-04 23:21:09.650236137 -0600
  109. @@ -194,7 +194,7 @@
  110. if ( c-gecos && (g = (char *)malloc (c-gecos+1)) ) {
  111. strncpy (g, gecos, c-gecos);
  112. g[c-gecos] = 0;
  113. - while ( (c=rindex(g, ' ')) ) {
  114. + while ( (c=strrchr(g, ' ')) ) {
  115. if ( !check_passwd_string(passwd, c+1) ) {
  116. printf(_("Please don't use something like your realname as password!\n"));
  117. free (g);
  118. diff -ur util-linux-2.12r/login-utils/vipw.c util-linux-2.12r-patched/login-utils/vipw.c
  119. --- util-linux-2.12r/login-utils/vipw.c 2004-03-04 15:54:44.000000000 -0600
  120. +++ util-linux-2.12r-patched/login-utils/vipw.c 2006-12-04 23:21:09.650236137 -0600
  121. @@ -314,7 +314,7 @@
  122. textdomain(PACKAGE);
  123. bzero(tmp_file, FILENAMELEN);
  124. - progname = (rindex(argv[0], '/')) ? rindex(argv[0], '/') + 1 : argv[0];
  125. + progname = (strrchr(argv[0], '/')) ? strrchr(argv[0], '/') + 1 : argv[0];
  126. if (!strcmp(progname, "vigr")) {
  127. program = VIGR;
  128. xstrncpy(orig_file, GROUP_FILE, sizeof(orig_file));
  129. diff -ur util-linux-2.12r/login-utils/wall.c util-linux-2.12r-patched/login-utils/wall.c
  130. --- util-linux-2.12r/login-utils/wall.c 2002-03-08 17:00:19.000000000 -0600
  131. +++ util-linux-2.12r-patched/login-utils/wall.c 2006-12-04 23:21:09.650236137 -0600
  132. @@ -87,7 +87,7 @@
  133. textdomain(PACKAGE);
  134. progname = argv[0];
  135. - p = rindex(progname, '/');
  136. + p = strrchr(progname, '/');
  137. if (p)
  138. progname = p+1;
  139. diff -ur util-linux-2.12r/misc-utils/logger.c util-linux-2.12r-patched/misc-utils/logger.c
  140. --- util-linux-2.12r/misc-utils/logger.c 2004-09-06 16:13:49.000000000 -0500
  141. +++ util-linux-2.12r-patched/misc-utils/logger.c 2006-12-04 23:21:09.650236137 -0600
  142. @@ -198,7 +198,7 @@
  143. } else {
  144. if (p != buf)
  145. *p++ = ' ';
  146. - bcopy(*argv++, p, len);
  147. + memcpy(p, *argv++, len);
  148. *(p += len) = '\0';
  149. }
  150. }
  151. diff -ur util-linux-2.12r/misc-utils/whereis.c util-linux-2.12r-patched/misc-utils/whereis.c
  152. --- util-linux-2.12r/misc-utils/whereis.c 2001-03-15 04:09:58.000000000 -0600
  153. +++ util-linux-2.12r-patched/misc-utils/whereis.c 2006-12-04 23:21:09.650236137 -0600
  154. @@ -323,14 +323,14 @@
  155. char dirbuf[1024];
  156. struct stat statbuf;
  157. - dd = index(dir, '*');
  158. + dd = strchr(dir, '*');
  159. if (!dd)
  160. goto noglob;
  161. l = strlen(dir);
  162. if (l < sizeof(dirbuf)) { /* refuse excessively long names */
  163. strcpy (dirbuf, dir);
  164. - d = index(dirbuf, '*');
  165. + d = strchr(dirbuf, '*');
  166. *d = 0;
  167. dirp = opendir(dirbuf);
  168. if (dirp == NULL)
  169. diff -ur util-linux-2.12r/mount/mntent.c util-linux-2.12r-patched/mount/mntent.c
  170. --- util-linux-2.12r/mount/mntent.c 2004-10-13 15:57:34.000000000 -0500
  171. +++ util-linux-2.12r-patched/mount/mntent.c 2006-12-04 23:21:09.650236137 -0600
  172. @@ -158,7 +158,7 @@
  173. return NULL;
  174. mfp->mntent_lineno++;
  175. - s = index (buf, '\n');
  176. + s = strchr (buf, '\n');
  177. if (s == NULL) {
  178. /* Missing final newline? Otherwise extremely */
  179. /* long line - assume file was corrupted */
  180. @@ -166,7 +166,7 @@
  181. fprintf(stderr, _("[mntent]: warning: no final "
  182. "newline at the end of %s\n"),
  183. mfp->mntent_file);
  184. - s = index (buf, 0);
  185. + s = strchr (buf, 0);
  186. } else {
  187. mfp->mntent_errs = 1;
  188. goto err;
  189. diff -ur util-linux-2.12r/mount/mount.c util-linux-2.12r-patched/mount/mount.c
  190. --- util-linux-2.12r/mount/mount.c 2004-12-21 16:00:36.000000000 -0600
  191. +++ util-linux-2.12r-patched/mount/mount.c 2006-12-04 23:21:09.654236454 -0600
  192. @@ -488,11 +488,11 @@
  193. /* Accept a comma-separated list of types, and try them one by one */
  194. /* A list like "nonfs,.." indicates types not to use */
  195. - if (*types && strncmp(*types, "no", 2) && index(*types,',')) {
  196. + if (*types && strncmp(*types, "no", 2) && strchr(*types,',')) {
  197. char *t = strdup(*types);
  198. char *p;
  199. - while((p = index(t,',')) != NULL) {
  200. + while((p = strchr(t,',')) != NULL) {
  201. *p = 0;
  202. args.type = *types = t;
  203. if(do_mount_syscall (&args) == 0)
  204. diff -ur util-linux-2.12r/mount/mount_by_label.c util-linux-2.12r-patched/mount/mount_by_label.c
  205. --- util-linux-2.12r/mount/mount_by_label.c 2004-12-21 17:15:33.000000000 -0600
  206. +++ util-linux-2.12r-patched/mount/mount_by_label.c 2006-12-04 23:21:09.654236454 -0600
  207. @@ -213,7 +213,7 @@
  208. fseek(procpt, 0, SEEK_SET);
  209. while (fgets(line, sizeof(line), procpt)) {
  210. - if (!index(line, '\n'))
  211. + if (!strchr(line, '\n'))
  212. break;
  213. if (sscanf (line, " %d %d %d %[^\n ]",
  214. diff -ur util-linux-2.12r/mount/sundries.c util-linux-2.12r-patched/mount/sundries.c
  215. --- util-linux-2.12r/mount/sundries.c 2004-12-21 13:12:31.000000000 -0600
  216. +++ util-linux-2.12r-patched/mount/sundries.c 2006-12-04 23:21:09.654236454 -0600
  217. @@ -138,7 +138,7 @@
  218. if (strncmp(p, type, len) == 0 &&
  219. (p[len] == 0 || p[len] == ','))
  220. return !no;
  221. - p = index(p,',');
  222. + p = strchr(p,',');
  223. if (!p)
  224. break;
  225. p++;
  226. diff -ur util-linux-2.12r/mount/umount.c util-linux-2.12r-patched/mount/umount.c
  227. --- util-linux-2.12r/mount/umount.c 2005-09-10 13:07:38.000000000 -0500
  228. +++ util-linux-2.12r-patched/mount/umount.c 2006-12-04 23:21:09.654236454 -0600
  229. @@ -338,7 +338,7 @@
  230. if (res < 0)
  231. umnt_err2 = errno;
  232. /* Do not complain about remote NFS mount points */
  233. - if (errno == ENOENT && index(spec, ':'))
  234. + if (errno == ENOENT && strchr(spec, ':'))
  235. umnt_err2 = 0;
  236. }
  237. }
  238. diff -ur util-linux-2.12r/text-utils/colcrt.c util-linux-2.12r-patched/text-utils/colcrt.c
  239. --- util-linux-2.12r/text-utils/colcrt.c 2001-03-15 04:09:59.000000000 -0600
  240. +++ util-linux-2.12r-patched/text-utils/colcrt.c 2006-12-04 23:23:45.614600041 -0600
  241. @@ -252,8 +252,8 @@
  242. }
  243. putwchar('\n');
  244. }
  245. - bcopy(page[ol], page, (267 - ol) * 132 * sizeof(wchar_t));
  246. - bzero(page[267- ol], ol * 132 * sizeof(wchar_t));
  247. + memcpy(page, page[ol], (267 - ol) * 132 * sizeof(wchar_t));
  248. + memset(page[267- ol], 0, ol * 132 * sizeof(wchar_t));
  249. outline -= ol;
  250. outcol = 0;
  251. first = 1;
  252. diff -ur util-linux-2.12r/text-utils/display.c util-linux-2.12r-patched/text-utils/display.c
  253. --- util-linux-2.12r/text-utils/display.c 2002-03-08 17:05:39.000000000 -0600
  254. +++ util-linux-2.12r-patched/text-utils/display.c 2006-12-04 23:24:32.478315487 -0600
  255. @@ -163,7 +163,7 @@
  256. pr->cchar[0] = 's';
  257. pr->cchar[1] = 0;
  258. for (p1 = pr->fmt; *p1 != '%'; ++p1);
  259. - for (p2 = ++p1; *p1 && index(spec, *p1); ++p1);
  260. + for (p2 = ++p1; *p1 && strchr(spec, *p1); ++p1);
  261. while ((*p2++ = *p1++) != 0) ;
  262. }
  263. diff -ur util-linux-2.12r/text-utils/parse.c util-linux-2.12r-patched/text-utils/parse.c
  264. --- util-linux-2.12r/text-utils/parse.c 2002-03-08 17:07:00.000000000 -0600
  265. +++ util-linux-2.12r-patched/text-utils/parse.c 2006-12-04 23:24:19.913319294 -0600
  266. @@ -64,7 +64,7 @@
  267. exit(1);
  268. }
  269. while (fgets(buf, sizeof(buf), fp)) {
  270. - if ((p = index(buf, '\n')) == NULL) {
  271. + if ((p = strchr(buf, '\n')) == NULL) {
  272. (void)fprintf(stderr, _("hexdump: line too long.\n"));
  273. while ((ch = getchar()) != '\n' && ch != EOF);
  274. continue;
  275. @@ -171,7 +171,7 @@
  276. * skip any special chars -- save precision in
  277. * case it's a %s format.
  278. */
  279. - while (index(spec + 1, *++fmt));
  280. + while (strchr(spec + 1, *++fmt));
  281. if (*fmt == '.' && isdigit((unsigned char)*++fmt)) {
  282. prec = atoi(fmt);
  283. while (isdigit((unsigned char)*++fmt));
  284. @@ -244,10 +244,10 @@
  285. if (fu->bcnt) {
  286. sokay = USEBCNT;
  287. /* skip to conversion character */
  288. - for (++p1; index(spec, *p1); ++p1);
  289. + for (++p1; strchr(spec, *p1); ++p1);
  290. } else {
  291. /* skip any special chars, field width */
  292. - while (index(spec + 1, *++p1));
  293. + while (strchr(spec + 1, *++p1));
  294. if (*p1 == '.' &&
  295. isdigit((unsigned char)*++p1)) {
  296. sokay = USEPREC;