mount.nfs: Simplify generation of progname
authorChuck Lever <chuck.lever@oracle.com>
Mon, 16 Jul 2007 20:28:10 +0000 (16:28 -0400)
committerNeil Brown <neilb@suse.de>
Fri, 20 Jul 2007 06:09:18 +0000 (16:09 +1000)
Use basename() instead of our own majick.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
utils/mount/mount.c

index 17c79e4..e2d3b53 100644 (file)
@@ -384,15 +384,10 @@ int main(int argc, char *argv[])
 {
        int c, flags = 0, nfs_mount_vers = 0, mnt_err = 1, fake = 0;
        char *spec, *mount_point, *extra_opts = NULL;
-       char *mount_opts = NULL, *p;
+       char *mount_opts = NULL;
        uid_t uid = getuid();
 
-       progname = argv[0];
-       if (!progname)
-               exit(2);
-
-       if ((p = strrchr(progname, '/')) != NULL)
-               progname = p+1;
+       progname = basename(argv[0]);
 
        if(!strncmp(progname, "umount", strlen("umount"))) {
                if(argc < 2) {