diff options
Diffstat (limited to 'contrib/umountd/umountd.c')
| -rw-r--r-- | contrib/umountd/umountd.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/contrib/umountd/umountd.c b/contrib/umountd/umountd.c index 42f867d1983..3f933ecb554 100644 --- a/contrib/umountd/umountd.c +++ b/contrib/umountd/umountd.c @@ -23,11 +23,11 @@ #include <sys/stat.h> #include <sys/mount.h> -#include "glusterfs.h" -#include "globals.h" -#include "logging.h" -#include "syscall.h" -#include "mem-types.h" +#include "glusterfs/glusterfs.h" +#include "glusterfs/globals.h" +#include "glusterfs/logging.h" +#include "glusterfs/syscall.h" +#include "glusterfs/mem-types.h" static void usage (void) @@ -49,22 +49,30 @@ sanity_check (char *path, dev_t *devp) if (path == NULL) usage (); - if (stat (path, &st) != 0) { - gf_log ("umountd", GF_LOG_ERROR, - "Cannot access %s\n", path, strerror (errno)); - goto out; + if ((ret = stat (path, &st)) != 0) { + switch (errno) { + case ENOTCONN: + /* volume is stopped */ + break; + default: + gf_log ("umountd", GF_LOG_ERROR, + "Cannot access %s: %s\n", + path, strerror (errno)); + goto out; + } } /* If dev was not specified, get it from path */ - if (*devp == -1) + if (*devp == -1 && ret == 0) *devp = st.st_dev; - strncpy (pathtmp, path, PATH_MAX); + snprintf (pathtmp, PATH_MAX, "%s", path); parent = dirname (pathtmp); if (stat (parent, &parent_st) != 0) { gf_log ("umountd", GF_LOG_ERROR, - "Cannot access %s\n", parent, strerror (errno)); + "Cannot access %s: %s\n", + parent, strerror (errno)); goto out; } |
