diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-12-04 09:40:42 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-12-04 09:40:42 +0000 |
commit | da84212fd714cbfcb58034df9dfc81d26a005b90 (patch) | |
tree | eab5ac7fadfa36867bd680e6c3682335c3aa4e1e /sbin/fsck | |
parent | a896d5b122400b305f94b41dd69d123785f6f3e6 (diff) |
nice argv[0], please do not bite me
Diffstat (limited to 'sbin/fsck')
-rw-r--r-- | sbin/fsck/fsck.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/sbin/fsck/fsck.c b/sbin/fsck/fsck.c index d105bdf723b..80e3d12e274 100644 --- a/sbin/fsck/fsck.c +++ b/sbin/fsck/fsck.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fsck.c,v 1.2 1996/12/04 01:31:11 deraadt Exp $ */ +/* $OpenBSD: fsck.c,v 1.3 1996/12/04 09:40:41 deraadt Exp $ */ /* $NetBSD: fsck.c,v 1.7 1996/10/03 20:06:30 christos Exp $ */ /* @@ -219,14 +219,9 @@ checkfs(vfstype, spec, mntpt, auxarg, pidp) const char **argv, **edir; pid_t pid; int argc, i, status, maxargc; - char *optbuf = NULL, execname[MAXPATHLEN + 1]; + char *optbuf = NULL, fsname[MAXPATHLEN], execname[MAXPATHLEN]; const char *extra = getoptions(vfstype); -#ifdef __GNUC__ - /* Avoid vfork clobbering */ - (void) &optbuf; -#endif - if (strcmp(vfstype, "ufs") == 0) vfstype = MOUNT_UFS; @@ -234,7 +229,8 @@ checkfs(vfstype, spec, mntpt, auxarg, pidp) argv = emalloc(sizeof(char *) * maxargc); argc = 0; - argv[argc++] = vfstype; + (void)snprintf(fsname, sizeof(fsname), "fsck_%s", vfstype); + argv[argc++] = fsname; if (options) { if (extra != NULL) @@ -252,14 +248,14 @@ checkfs(vfstype, spec, mntpt, auxarg, pidp) argv[argc] = NULL; if (flags & (CHECK_DEBUG|CHECK_VERBOSE)) { - (void)printf("start %s %swait fsck_%s", mntpt, - pidp ? "no" : "", vfstype); + (void)printf("start %s %swait %s", mntpt, + pidp ? "no" : "", fsname); for (i = 1; i < argc; i++) (void)printf(" %s", argv[i]); (void)printf("\n"); } - switch (pid = vfork()) { + switch (pid = fork()) { case -1: /* Error. */ warn("vfork"); if (optbuf) |