]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Fix a couple more unlink()s in vol-salvage.c
authorAndrew Deason <adeason@sinenomine.net>
Thu, 15 Oct 2009 18:15:44 +0000 (13:15 -0500)
committerDerrick Brashear <shadow|account-1000005@unknown>
Thu, 17 Dec 2009 06:56:47 +0000 (22:56 -0800)
There are a couple more unlink() calls in vol-salvage.c that were using
relative paths. Fix them to use absolute paths and to log a warning if
the unlink() fails.

Reviewed-on: http://gerrit.openafs.org/684
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit ebf6516db2f1105e5ca8172f6d64038c6acc60bd)
Change-Id: Id3a3ee7b6488f54f13f4e9b06996b039eb014e75
Reviewed-on: http://gerrit.openafs.org/973
Tested-by: Derrick Brashear <shadow@dementia.org>
src/vol/vol-salvage.c

index bd3f3b38f11986862bc037ee57f53661bccfd45f..728f04e67717d8a4afba1308387ea26e76f3907c 100644 (file)
@@ -1775,9 +1775,12 @@ GetVolumeSummary(VolumeId singleVolumeNumber)
            if (error) {
                if (!singleVolumeNumber) {
                    if (!Showmode)
-                       Log("%s/%s is not a legitimate volume header file; %sdeleted\n", fileSysPathName, dp->d_name, (Testing ? "it would have been " : ""));
-                   if (!Testing)
-                       unlink(dp->d_name);
+                       Log("%s is not a legitimate volume header file; %sdeleted\n", name, (Testing ? "it would have been " : ""));
+                   if (!Testing) {
+                       if (unlink(name)) {
+                           Log("Unable to unlink %s (errno = %d)\n", name, errno);
+                       }
+                   }
                }
            } else {
                char nameShouldBe[64];
@@ -1798,9 +1801,12 @@ GetVolumeSummary(VolumeId singleVolumeNumber)
                        AskOffline(vsp->header.id);
                    if (strcmp(nameShouldBe, dp->d_name)) {
                        if (!Showmode)
-                           Log("Volume header file %s is incorrectly named; %sdeleted (it will be recreated later, if necessary)\n", dp->d_name, (Testing ? "it would have been " : ""));
-                       if (!Testing)
-                           unlink(dp->d_name);
+                           Log("Volume header file %s is incorrectly named; %sdeleted (it will be recreated later, if necessary)\n", name, (Testing ? "it would have been " : ""));
+                       if (!Testing) {
+                           if (unlink(name)) {
+                               Log("Unable to unlink %s (errno = %d)\n", name, errno);
+                           }
+                       }
                    } else {
                        vsp->fileName = ToString(dp->d_name);
                        nVolumes++;