chiark / gitweb /
Prep v226: Apply missing fixes and changes to src/basic
[elogind.git] / src / basic / util.c
index 473165f24581fd134d7052891e1a67622522d6eb..3df91488c2de44bf812fa76ce1fa4aa189414ce4 100644 (file)
@@ -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;
@@ -6198,6 +6201,9 @@ int openpt_in_namespace(pid_t pid, int flags) {
                 if (master < 0)
                         _exit(EXIT_FAILURE);
 
+                if (unlockpt(master) < 0)
+                        _exit(EXIT_FAILURE);
+
                 cmsg = CMSG_FIRSTHDR(&mh);
                 cmsg->cmsg_level = SOL_SOCKET;
                 cmsg->cmsg_type = SCM_RIGHTS;