]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Unlink correct files in salvager
authorAndrew Deason <adeason@sinenomine.net>
Mon, 21 Sep 2009 17:48:30 +0000 (12:48 -0500)
committerDerrick Brashear <shadow|account-1000005@unknown>
Thu, 17 Dec 2009 06:51:21 +0000 (22:51 -0800)
Fallout from 0ac956b3384842b3c60e72bde78a4baf58a5877f; a couple of
unlink() calls were not updated to use the absolute path. Update them,
and log errors from unlink(), since otherwise it is difficult to tell
that anything is going wrong.

Reviewed-on: http://gerrit.openafs.org/479
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 29ee678f3ab051a27cae46b02a0d42e0958a6bc8)
Change-Id: Ic7bc1f3470e705f03fee044f438804cdd211db6b
Reviewed-on: http://gerrit.openafs.org/962

src/vol/vol-salvage.c

index b217481e18d439e7c4a2548565e06a771c08cf93..bd3f3b38f11986862bc037ee57f53661bccfd45f 100644 (file)
@@ -1385,10 +1385,16 @@ SalvageFileSys1(struct DiskPartition64 *partP, VolumeId singleVolumeNumber)
 void
 DeleteExtraVolumeHeaderFile(register struct VolumeSummary *vsp)
 {
+    char path[64];
+    sprintf(path, "%s/%s", fileSysPath, vsp->fileName);
+
     if (!Showmode)
-       Log("The volume header file %s is not associated with any actual data (%sdeleted)\n", vsp->fileName, (Testing ? "would have been " : ""));
-    if (!Testing)
-       unlink(vsp->fileName);
+       Log("The volume header file %s is not associated with any actual data (%sdeleted)\n", path, (Testing ? "would have been " : ""));
+    if (!Testing) {
+       if (unlink(path)) {
+           Log("Unable to unlink %s (errno = %d)\n", path, errno);
+       }
+    }
     vsp->fileName = 0;
 }
 
@@ -3777,8 +3783,13 @@ MaybeZapVolume(register struct InodeSummary *isp, char *message, int deleteMe,
                if (!Showmode)
                    Log("it will be deleted instead.  It should be recloned.\n");
            }
-           if (!Testing)
-               unlink(isp->volSummary->fileName);
+           if (!Testing) {
+               char path[64];
+               sprintf(path, "%s/%s", fileSysPath, isp->volSummary->fileName);
+               if (unlink(path)) {
+                   Log("Unable to unlink %s (errno = %d)\n", path, errno);
+               }
+           }
        }
     } else if (!check) {
        Log("%s salvage was unsuccessful: read-write volume %u\n", message,