[Pkg-gnupg-commit] [gnupg2] 02/132: agent: Minor fix for get_client_pid.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed May 17 03:07:34 UTC 2017


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch experimental
in repository gnupg2.

commit 5744d2038bd17b8b1be4e73d0ad3bc41772efe96
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Tue Apr 4 10:39:00 2017 +0900

    agent: Minor fix for get_client_pid.
    
    * agent/command-ssh.c (get_client_pid): Use 0 to initialize.
    
    Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
---
 agent/command-ssh.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/agent/command-ssh.c b/agent/command-ssh.c
index 5a02542..b15d8b2 100644
--- a/agent/command-ssh.c
+++ b/agent/command-ssh.c
@@ -3567,7 +3567,7 @@ ssh_request_process (ctrl_t ctrl, estream_t stream_sock)
 static unsigned long
 get_client_pid (int fd)
 {
-  pid_t client_pid = (pid_t)(-1);
+  pid_t client_pid = (pid_t)0;
 
 #ifdef SO_PEERCRED
   {
@@ -3578,7 +3578,7 @@ get_client_pid (int fd)
 #endif
     socklen_t cl = sizeof cr;
 
-    if ( !getsockopt (fd, SOL_SOCKET, SO_PEERCRED, &cr, &cl))
+    if (!getsockopt (fd, SOL_SOCKET, SO_PEERCRED, &cr, &cl))
       {
 #if defined (HAVE_STRUCT_SOCKPEERCRED_PID) || defined (HAVE_STRUCT_UCRED_PID)
         client_pid = cr.pid;
@@ -3593,7 +3593,7 @@ get_client_pid (int fd)
   {
     socklen_t len = sizeof (pid_t);
 
-    getsockopt(fd, SOL_LOCAL, LOCAL_PEERPID, &client_pid, &len);
+    getsockopt (fd, SOL_LOCAL, LOCAL_PEERPID, &client_pid, &len);
   }
 #elif defined (LOCAL_PEEREID)
   {
@@ -3613,9 +3613,11 @@ get_client_pid (int fd)
         ucred_free (ucred);
       }
   }
+#else
+  (void)fd;
 #endif
 
-  return client_pid == (pid_t)(-1)? 0 : (unsigned long)client_pid;
+  return (unsigned long)client_pid;
 }
 
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list