aboutsummaryrefslogtreecommitdiffhomepage
path: root/env.cpp
diff options
context:
space:
mode:
authorGravatar Kevin Ballard <kevin@sb.org>2014-07-13 19:08:15 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-08-21 19:06:21 -0700
commit9f725bee1f59df961e93e3d2392bc779281d7de7 (patch)
treeb859c757b7c14e4fafb03fef990706e1c2a950b6 /env.cpp
parentd0c85471b40fee548efc35a370f5d5c4b656f66a (diff)
set: Print an error when setting `umask` to a bad value
Repurpose the ENV_INVALID return value for env_set(), which wasn't currently used by anything. When a bad value is passed for the 'umask' key, return ENV_INVALID to signal this and print a good error message from the `set` builtin. This makes `set umask foo` properly produce an error.
Diffstat (limited to 'env.cpp')
-rw-r--r--env.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/env.cpp b/env.cpp
index 88d61c85..91bc7ac8 100644
--- a/env.cpp
+++ b/env.cpp
@@ -655,10 +655,12 @@ int env_set(const wcstring &key, const wchar_t *val, env_mode_flags_t var_mode)
if (!errno && (!*end) && (mask <= 0777) && (mask >= 0))
{
umask(mask);
+ /* Do not actually create a umask variable, on env_get, it will be calculated dynamically */
+ return 0;
}
}
- /* Do not actually create a umask variable, on env_get, it will be calculated dynamically */
- return 0;
+
+ return ENV_INVALID;
}
/*