summaryrefslogtreecommitdiff
path: root/src/basic/util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-09-03 18:23:26 +0200
committerLennart Poettering <lennart@poettering.net>2015-09-04 09:07:31 +0200
commitef5c570edfd8afb20e3b04d3711e111a1dea0548 (patch)
tree458750d6fc37079a2948f2f72220c2ecc96839ff /src/basic/util.c
parentb3ac818be8d73c97dc4f74ba8bbd2091506df2e6 (diff)
util: document why parse_uid() returns ENXIO
parse_uid() returns EINVAL for invalid strings, but ENXIO for the (uid_t) -1 user ids in order to distinguish these two cases. Document this.
Diffstat (limited to 'src/basic/util.c')
-rw-r--r--src/basic/util.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/basic/util.c b/src/basic/util.c
index beec7cb7dd..86aacad307 100644
--- a/src/basic/util.c
+++ b/src/basic/util.c
@@ -403,7 +403,10 @@ int parse_uid(const char *s, uid_t* ret_uid) {
return -ERANGE;
if (!uid_is_valid(uid))
- return -ENXIO;
+ return -ENXIO; /* we return ENXIO instead of EINVAL
+ * here, to make it easy to distuingish
+ * invalid numeric uids invalid
+ * strings. */
if (ret_uid)
*ret_uid = uid;