chiark / gitweb /
shared: add formats-util.h
[elogind.git] / src / shared / spawn-ask-password-agent.c
index c1a9c5868140edab497bb43d55c8e5227d4597bd..70466d17e5e3af461122bdfe4d17ad5ba5a66bc8 100644 (file)
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <sys/types.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include <string.h>
-#include <sys/prctl.h>
 #include <signal.h>
-#include <fcntl.h>
 
 #include "log.h"
 #include "util.h"
+#include "process-util.h"
 #include "spawn-ask-password-agent.h"
 
 static pid_t agent_pid = 0;
@@ -49,7 +46,7 @@ int ask_password_agent_open(void) {
                        SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH,
                        SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH, "--watch", NULL);
         if (r < 0)
-                log_error("Failed to fork TTY ask password agent: %s", strerror(-r));
+                log_error_errno(r, "Failed to fork TTY ask password agent: %m");
 
         return r;
 }
@@ -62,6 +59,6 @@ void ask_password_agent_close(void) {
         /* Inform agent that we are done */
         kill(agent_pid, SIGTERM);
         kill(agent_pid, SIGCONT);
-        wait_for_terminate(agent_pid, NULL);
+        (void) wait_for_terminate(agent_pid, NULL);
         agent_pid = 0;
 }