]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
mount.nfs: Eliminate compiler warnings
authorChuck Lever <chuck.lever@oracle.com>
Wed, 13 Oct 2010 15:38:22 +0000 (11:38 -0400)
committerSteve Dickson <steved@redhat.com>
Thu, 14 Oct 2010 14:26:58 +0000 (10:26 -0400)
Clean up.

fstab.c: In function ?lock_mtab?:
fstab.c:385: warning: declaration of ?errsv? shadows a previous local
fstab.c:367: warning: shadowed declaration is here
fstab.c:407: warning: declaration of ?errsv? shadows a previous local
fstab.c:367: warning: shadowed declaration is here
fstab.c:417: warning: declaration of ?tries? shadows a previous local
fstab.c:325: warning: shadowed declaration is here
fstab.c:422: warning: declaration of ?errsv? shadows a previous local
fstab.c:367: warning: shadowed declaration is here

These are probably harmless.  Reusing a variable name, however, is a
little confusing to follow when reading the code.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
utils/mount/fstab.c

index 051fa38c872503e37dfaca9e5c89c4ec4f2f7738..a742e648d0e4d133c7e24eb07f2c4d591ad44cd5 100644 (file)
@@ -364,19 +364,22 @@ lock_mtab (void) {
        /* Repeat until it was us who made the link */
        while (!we_created_lockfile) {
                struct flock flock;
-               int errsv, j;
+               int j;
 
                j = link(linktargetfile, MOUNTED_LOCK);
-               errsv = errno;
 
-               if (j == 0)
-                       we_created_lockfile = 1;
+               {
+                       int errsv = errno;
 
-               if (j < 0 && errsv != EEXIST) {
-                       (void) unlink(linktargetfile);
-                       die (EX_FILEIO, _("can't link lock file %s: %s "
-                            "(use -n flag to override)"),
-                            MOUNTED_LOCK, strerror (errsv));
+                       if (j == 0)
+                               we_created_lockfile = 1;
+
+                       if (j < 0 && errsv != EEXIST) {
+                               (void) unlink(linktargetfile);
+                               die (EX_FILEIO, _("can't link lock file %s: %s "
+                                    "(use -n flag to override)"),
+                                    MOUNTED_LOCK, strerror (errsv));
+                       }
                }
 
                lockfile_fd = open (MOUNTED_LOCK, O_WRONLY);
@@ -414,7 +417,7 @@ lock_mtab (void) {
                        }
                        (void) unlink(linktargetfile);
                } else {
-                       static int tries = 0;
+                       static int retries = 0;
 
                        /* Someone else made the link. Wait. */
                        alarm(LOCK_TIMEOUT);
@@ -428,10 +431,10 @@ lock_mtab (void) {
                        alarm(0);
                        /* Limit the number of iterations - maybe there
                           still is some old /etc/mtab~ */
-                       ++tries;
-                       if (tries % 200 == 0)
+                       ++retries;
+                       if (retries % 200 == 0)
                           usleep(30);
-                       if (tries > 100000) {
+                       if (retries > 100000) {
                                (void) unlink(linktargetfile);
                                close(lockfile_fd);
                                die (EX_FILEIO, _("Cannot create link %s\n"