diff options
Diffstat (limited to 'fdisk')
-rw-r--r-- | fdisk/cfdisk.c | 2 | ||||
-rw-r--r-- | fdisk/fdiskbsdlabel.c | 13 | ||||
-rw-r--r-- | fdisk/sfdisk.c | 10 |
3 files changed, 13 insertions, 12 deletions
diff --git a/fdisk/cfdisk.c b/fdisk/cfdisk.c index fc0357d2..1846e11c 100644 --- a/fdisk/cfdisk.c +++ b/fdisk/cfdisk.c @@ -357,7 +357,7 @@ xmalloc (size_t size) { /* 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; } diff --git a/fdisk/fdiskbsdlabel.c b/fdisk/fdiskbsdlabel.c index 377b64ec..d5243b9e 100644 --- a/fdisk/fdiskbsdlabel.c +++ b/fdisk/fdiskbsdlabel.c @@ -538,7 +538,7 @@ xbsd_write_bootstrap (void) /* 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)); @@ -555,7 +555,7 @@ xbsd_write_bootstrap (void) exit ( EXIT_FAILURE ); } - bcopy (&dl, d, sizeof (struct xbsd_disklabel)); + memmove (d, &dl, sizeof (struct xbsd_disklabel)); #if defined (__powerpc__) || defined (__hppa__) sector = 0; @@ -740,8 +740,9 @@ xbsd_readlabel (struct partition *p, struct xbsd_disklabel *d) 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 +777,8 @@ xbsd_writelabel (struct partition *p, struct xbsd_disklabel *d) /* 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); diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c index da779aa8..8fae5bb5 100644 --- a/fdisk/sfdisk.c +++ b/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(), strrchr() */ #include <ctype.h> #include <getopt.h> #include <sys/ioctl.h> @@ -1725,12 +1725,12 @@ read_stdin(char **fields, char *line, int fieldssize, int linesize) { 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 */ @@ -1740,7 +1740,7 @@ read_stdin(char **fields, char *line, int fieldssize, int linesize) { } /* dump style? - then bad input is fatal */ - if ((ip = index(line+2, ':')) != 0) { + if ((ip = strchr(line+2, ':')) != 0) { struct dumpfld *d; nxtfld: @@ -2503,7 +2503,7 @@ main(int argc, char **argv) { if (argc < 1) fatal(_("no command?\n")); - if ((progn = rindex(argv[0], '/')) == NULL) + if ((progn = strrchr(argv[0], '/')) == NULL) progn = argv[0]; else progn++; |