summaryrefslogtreecommitdiff
path: root/util/nvmutil
diff options
context:
space:
mode:
Diffstat (limited to 'util/nvmutil')
-rw-r--r--util/nvmutil/lib/file.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/util/nvmutil/lib/file.c b/util/nvmutil/lib/file.c
index 786c51fb..6546c252 100644
--- a/util/nvmutil/lib/file.c
+++ b/util/nvmutil/lib/file.c
@@ -453,16 +453,20 @@ env_tmpdir(int bypass_all_sticky_checks)
if (t != NULL && *t != '\0') {
if (tmpdir_policy(t,
- &allow_noworld_unsticky) == 0) {
-
- if (world_writeable_and_sticky(t,
- allow_noworld_unsticky,
- bypass_all_sticky_checks)) {
+ &allow_noworld_unsticky) < 0) {
+ errno = EPERM;
+ return NULL; /* errno already set */
+ }
- errno = saved_errno;
- return t;
- }
+ if (!world_writeable_and_sticky(t,
+ allow_noworld_unsticky,
+ bypass_all_sticky_checks)) {
+ errno = EPERM;
+ return NULL;
}
+
+ errno = saved_errno;
+ return t;
}
allow_noworld_unsticky = 0;