]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Unix afsd: Check for mountpoint /afs first
authorChristof Hanke <christof.hanke@rzg.mpg.de>
Sun, 28 Nov 2010 12:01:12 +0000 (13:01 +0100)
committerDerrick Brashear <shadow@dementia.org>
Mon, 31 Jan 2011 19:28:23 +0000 (11:28 -0800)
Check for the existance of the mountpoint before trying to
start.

Reviewed-on: http://gerrit.openafs.org/3392
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit cc54175e43ce14c01f9c103541ffad795b17629c)

Change-Id: Ic94f1701f5d1d0d080e5751093a685e89d892b1a
Reviewed-on: http://gerrit.openafs.org/3782
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
src/afsd/afsd.c

index 90a4cdbe33ca03cbb5b762d8647a0ce9c2f747db..5eee1f19417b7297013fb190ebe3050f603b845e 100644 (file)
@@ -1923,6 +1923,7 @@ afsd_run(void)
 {
     static char rn[] = "afsd"; /*Name of this routine */
     struct afsconf_dir *cdir;  /* config dir */
+    struct stat statbuf;
     int lookupResult;          /*Result of GetLocalCellName() */
     int i;
     afs_int32 code;            /*Result of fork() */
@@ -1956,6 +1957,16 @@ afsd_run(void)
        exit(1);
     }
 
+    if (stat(afsd_cacheMountDir, &statbuf)) {
+       printf("afsd: Mountpoint %s missing.\n", afsd_cacheMountDir);
+        exit(1);
+    } else {
+       if (!S_ISDIR(statbuf.st_mode)) {
+           printf("afsd: Mountpoint %s is not a directory.\n", afsd_cacheMountDir);
+           exit(1);
+       }
+    }
+
     /* do some random computations in memcache case to get things to work
      * reasonably no matter which parameters you set.
      */