]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
salvager-no-chdir-20081108
authorSteve McIntosh <stevemac@endpoint.com>
Sat, 8 Nov 2008 15:58:06 +0000 (15:58 +0000)
committerDerrick Brashear <shadow|account-1000005@unknown>
Thu, 17 Dec 2009 06:22:19 +0000 (22:22 -0800)
LICENSE IPL10
FIXES 123577

make sure salvager cores don't get left in vice partitions
(cherry picked from commit 0ac956b3384842b3c60e72bde78a4baf58a5877f)

Change-Id: I12f34ef66d7783d5615959553749b7a2ec4f2692
Reviewed-on: http://gerrit.openafs.org/921
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
src/vol/vol-info.c
src/vol/vol-salvage.c

index ebcbcda6747f7ec8c4210ecd495a993ef1a3a4e6..201bc933917f06f05b0268180e1d280cc16e1742 100644 (file)
@@ -411,11 +411,7 @@ HandlePart(struct DiskPartition64 *partP)
     char *p = VPartitionPath(partP);
 #endif
 
-    if (chdir(p) == -1) {
-       printf("Can't chdir to partition %s; giving up\n", p);
-       exit(1);
-    }
-    if ((dirp = opendir(".")) == NULL) {
+    if ((dirp = opendir(p)) == NULL) {
        printf("Can't read directory %s; giving up\n", p);
        exit(1);
     }
index 6a89c1206a9b73cd9cd1337c72aed15645d157a9..b217481e18d439e7c4a2548565e06a771c08cf93 100644 (file)
@@ -1716,7 +1716,8 @@ GetVolumeSummary(VolumeId singleVolumeNumber)
     struct dirent *dp;
 
     /* Get headers from volume directory */
-    if (chdir(fileSysPath) == -1 || (dirp = opendir(".")) == NULL)
+    dirp = opendir(fileSysPath);
+    if (dirp  == NULL)
        Abort("Can't read directory %s; not salvaged\n", fileSysPath);
     if (!singleVolumeNumber) {
        while ((dp = readdir(dirp))) {
@@ -4067,16 +4068,18 @@ ToString(char *s)
     assert(p != NULL);
     strcpy(p, s);
     return p;
-
 }
 
 /* Remove the FORCESALVAGE file */
 void
 RemoveTheForce(char *path)
 {
+    char target[1024];
+    struct afs_stat force; // so we can use afs_stat to find it
+    strcpy(target,path);
+    strcat(target,"/FORCESALVAGE");
     if (!Testing && ForceSalvage) {
-       if (chdir(path) == 0)
-           unlink("FORCESALVAGE");
+        if (afs_stat(target,&force) == 0)  unlink(target);
     }
 }
 
@@ -4088,10 +4091,11 @@ int
 UseTheForceLuke(char *path)
 {
     struct afs_stat force;
+    char target[1024];
+    strcpy(target,path);
+    strcat(target,"/FORCESALVAGE");
 
-    assert(chdir(path) != -1);
-
-    return (afs_stat("FORCESALVAGE", &force) == 0);
+    return (afs_stat(target, &force) == 0);
 }
 #else
 /*