diff options
Diffstat (limited to 'util')
| -rw-r--r-- | util/nvmutil/nvmutil.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index b40a0910..c7093501 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -3231,6 +3231,8 @@ x_try_fdpath(const char *prefix, int fd, mode_t mode) unsigned long i = 0; unsigned long j; + struct stat st; + while (prefix[i]) { if (i >= PATH_LEN - 1) return -1; @@ -3246,6 +3248,9 @@ x_try_fdpath(const char *prefix, int fd, mode_t mode) i += j; path[i] = '\0'; + if (stat(path, &st) < 0) + return -1; + return chmod(path, mode); } |
