From: Andrew Deason Date: Mon, 21 May 2012 22:11:29 +0000 (-0500) Subject: afsd: Avoid dir interpolation for memcache X-Git-Tag: upstream/1.6.2_pre2^2~167 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=8c99f6de5d6a7701f6b2b7cd8ba5b9a808d79946;p=packages%2Fo%2Fopenafs.git afsd: Avoid dir interpolation for memcache memcache doesn't make use of fullpn_DCacheFile, fullpn_VolInfoFile, etc. Do not even try to generate these strings for memcache, since cacheBaseDir will be NULL, and so this can cause a segfault on some platforms including Solaris. Reviewed-on: http://gerrit.openafs.org/7442 Tested-by: BuildBot Reviewed-by: Derrick Brashear (cherry picked from commit 2e2bc535bd03df86f78b648f78d2d0a95d273fab) Change-Id: I46f2da9b2f0e5f8d004ebd3d799a3c1ac22c3e95 Reviewed-on: http://gerrit.openafs.org/7501 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- diff --git a/src/afsd/afsd.c b/src/afsd/afsd.c index aa6b2cc3b..603551fc1 100644 --- a/src/afsd/afsd.c +++ b/src/afsd/afsd.c @@ -2123,23 +2123,25 @@ afsd_run(void) cacheFiles, inode_for_V, (cacheFiles * sizeof(AFSD_INO_T))); #endif - /* - * Set up all the pathnames we'll need for later. - */ - sprintf(fullpn_DCacheFile, "%s/%s", cacheBaseDir, DCACHEFILE); - sprintf(fullpn_VolInfoFile, "%s/%s", cacheBaseDir, VOLINFOFILE); - sprintf(fullpn_CellInfoFile, "%s/%s", cacheBaseDir, CELLINFOFILE); - sprintf(fullpn_VFile, "%s/", cacheBaseDir); - vFilePtr = fullpn_VFile + strlen(fullpn_VFile); - - if (!(cacheFlags & AFSCALL_INIT_MEMCACHE) - && (fsTypeMsg = CheckCacheBaseDir(cacheBaseDir))) { + if (!(cacheFlags & AFSCALL_INIT_MEMCACHE)) { + /* + * Set up all the pathnames we'll need for later. + */ + sprintf(fullpn_DCacheFile, "%s/%s", cacheBaseDir, DCACHEFILE); + sprintf(fullpn_VolInfoFile, "%s/%s", cacheBaseDir, VOLINFOFILE); + sprintf(fullpn_CellInfoFile, "%s/%s", cacheBaseDir, CELLINFOFILE); + sprintf(fullpn_VFile, "%s/", cacheBaseDir); + vFilePtr = fullpn_VFile + strlen(fullpn_VFile); + + fsTypeMsg = CheckCacheBaseDir(cacheBaseDir); + if (fsTypeMsg) { #ifdef AFS_SUN5_ENV - printf("%s: WARNING: Cache dir check failed (%s)\n", rn, fsTypeMsg); + printf("%s: WARNING: Cache dir check failed (%s)\n", rn, fsTypeMsg); #else - printf("%s: ERROR: Cache dir check failed (%s)\n", rn, fsTypeMsg); - exit(1); + printf("%s: ERROR: Cache dir check failed (%s)\n", rn, fsTypeMsg); + exit(1); #endif + } } /*