chiark / gitweb /
Revert "ptyfwd: make master terminal attributes raw, too"
[elogind.git] / src / shared / util.c
index 2cf9fbe53e6f97c9b48e96f458d192741b185e10..f59897105a6354e1cea1c7261517e2a556c660ce 100644 (file)
@@ -6088,3 +6088,13 @@ int namespace_enter(int pidns_fd, int mntns_fd, int root_fd) {
 
         return 0;
 }
+
+bool pid_valid(pid_t pid) {
+        if (pid <= 0)
+                return false;
+
+        if (kill(pid, 0) >= 0)
+                return true;
+
+        return errno != ESRCH;
+}