From: Andrew Deason Date: Thu, 15 Oct 2009 18:15:44 +0000 (-0500) Subject: Fix a couple more unlink()s in vol-salvage.c X-Git-Tag: openafs-devel-1_5_66~40 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=ebf6516db2f1105e5ca8172f6d64038c6acc60bd;p=packages%2Fo%2Fopenafs.git Fix a couple more unlink()s in vol-salvage.c 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 Reviewed-by: Derrick Brashear --- diff --git a/src/vol/vol-salvage.c b/src/vol/vol-salvage.c index 51003eb67..f66ae82be 100644 --- a/src/vol/vol-salvage.c +++ b/src/vol/vol-salvage.c @@ -1269,9 +1269,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]; @@ -1306,9 +1309,12 @@ GetVolumeSummary(VolumeId singleVolumeNumber) AskOffline(vsp->header.id, fileSysPartition->name); 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++;