X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=support%2Fmisc%2Fmountpoint.c;h=a72fb92adf046cea2fd6acceb2a33df45521570f;hp=6d0f34eab4954826fd636dcf3a5dd4f1eef6b35f;hb=fe34ff0312c7c22554087ecd78bbbeadb38ce195;hpb=d38ea02d0e4bcdc4e0114567028596f7bcba45b9 diff --git a/support/misc/mountpoint.c b/support/misc/mountpoint.c index 6d0f34e..a72fb92 100644 --- a/support/misc/mountpoint.c +++ b/support/misc/mountpoint.c @@ -4,7 +4,7 @@ */ #include -#include +#include "xcommon.h" #include int @@ -20,15 +20,20 @@ is_mountpoint(char *path) */ char *dotdot; struct stat stb, pstb; + int rv; + + dotdot = xmalloc(strlen(path)+4); - dotdot = malloc(strlen(path)+4); strcat(strcpy(dotdot, path), "/.."); if (lstat(path, &stb) != 0 || lstat(dotdot, &pstb) != 0) - return 0; - - if (stb.st_dev != pstb.st_dev - || stb.st_ino == pstb.st_ino) - return 1; - return 0; + rv = 0; + else + if (stb.st_dev != pstb.st_dev || + stb.st_ino == pstb.st_ino) + rv = 1; + else + rv = 0; + free(dotdot); + return rv; }