From: Christof Hanke Date: Sun, 28 Nov 2010 12:01:12 +0000 (+0100) Subject: Unix afsd: Check for mountpoint /afs first X-Git-Tag: upstream/1.8.0_pre1^2~4427 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=cc54175e43ce14c01f9c103541ffad795b17629c;p=packages%2Fo%2Fopenafs.git Unix afsd: Check for mountpoint /afs first Check for the existance of the mountpoint before trying to start. Change-Id: I56c7a69b2b24c465f987e33c3f88c6ac37e40dd0 Reviewed-on: http://gerrit.openafs.org/3392 Tested-by: BuildBot Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- diff --git a/src/afsd/afsd.c b/src/afsd/afsd.c index 4c9cdd79e..495ceb3e5 100644 --- a/src/afsd/afsd.c +++ b/src/afsd/afsd.c @@ -1918,6 +1918,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() */ @@ -1951,6 +1952,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. */