Skip to contentSkip to conversation

mount.nfs: Simplify handling of progname

PATCH In review Chuck Lever 1 participant 1 message Jul 16, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/17 mount.nfs: Simplify handling of progname

Clean up.

---

 utils/mount/mount.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)
utils/mount/mount.c +2 -7
index c163922..5a7bd1c 100644
@@ -383,15 +383,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) {

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs