Unlink correct files in salvager

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>
This commit is contained in:
Andrew Deason 2009-09-21 12:48:30 -05:00 committed by Derrick Brashear
parent 07b1dc861b
commit 29ee678f3a

View File

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