chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
util: fix comment
[elogind.git]
/
src
/
shared
/
util.c
diff --git
a/src/shared/util.c
b/src/shared/util.c
index 882a6908f2b182833bf220db6f719245cc0700f6..af6bde2c3dd280e8c3f72f090d035d8d88b32e17 100644
(file)
--- a/
src/shared/util.c
+++ b/
src/shared/util.c
@@
-280,6
+280,14
@@
int parse_uid(const char *s, uid_t* ret_uid) {
if ((unsigned long) uid != ul)
return -ERANGE;
if ((unsigned long) uid != ul)
return -ERANGE;
+ /* Some libc APIs use (uid_t) -1 as special placeholder */
+ if (uid == (uid_t) 0xFFFFFFFF)
+ return -EINVAL;
+
+ /* A long time ago UIDs where 16bit, hence explicitly avoid the 16bit -1 too */
+ if (uid == (uid_t) 0xFFFF)
+ return -EINVAL;
+
*ret_uid = uid;
return 0;
}
*ret_uid = uid;
return 0;
}
@@
-1440,7
+1448,7
@@
_pure_ static bool fd_in_set(int fd, const int fdset[], unsigned n_fdset) {
}
int close_all_fds(const int except[], unsigned n_except) {
}
int close_all_fds(const int except[], unsigned n_except) {
-
DIR *d
;
+
_cleanup_closedir_ DIR *d = NULL
;
struct dirent *de;
int r = 0;
struct dirent *de;
int r = 0;
@@
-1495,7
+1503,6
@@
int close_all_fds(const int except[], unsigned n_except) {
}
}
}
}
- closedir(d);
return r;
}
return r;
}
@@
-1514,6
+1521,7
@@
bool fstype_is_network(const char *fstype) {
static const char table[] =
"cifs\0"
"smbfs\0"
static const char table[] =
"cifs\0"
"smbfs\0"
+ "sshfs\0"
"ncpfs\0"
"ncp\0"
"nfs\0"
"ncpfs\0"
"ncp\0"
"nfs\0"