Author: vlendec
Date: 2005-09-26 10:36:58 +0000 (Mon, 26 Sep 2005)
New Revision: 10503

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=10503

Log:
A pid spec without ":" is local
Modified:
   branches/tmp/vl-cluster/source/lib/util.c


Changeset:
Modified: branches/tmp/vl-cluster/source/lib/util.c
===================================================================
--- branches/tmp/vl-cluster/source/lib/util.c   2005-09-26 09:04:28 UTC (rev 
10502)
+++ branches/tmp/vl-cluster/source/lib/util.c   2005-09-26 10:36:58 UTC (rev 
10503)
@@ -2798,7 +2798,7 @@
 
 struct process_id interpret_pid(const char *pid_string)
 {
-       char *p, *tmp;
+       char *p, *tmp, *pid;
        struct process_id result;
 
        ZERO_STRUCT(result);
@@ -2814,25 +2814,22 @@
                return result;
        }
 
+       result = procid_self();
+
+       pid = tmp;
+
        p = strchr(tmp, ':');
-       if (p == NULL) {
-               DEBUG(10, ("Could not find ':' in string %s\n", pid_string));
-               SAFE_FREE(tmp);
-               return result;
+       if (p != NULL) {
+               *p = '\0';
+               pid = p+1;
+               result.ip = *interpret_addr2(tmp);
        }
 
-       *p = '\0';
-       p += 1;
-
-       result.pid = strtoull(p, NULL, 10);
+       result.pid = strtoull(pid, NULL, 10);
        if (result.pid < 0) {
                DEBUG(10, ("Invalid pid: %s\n", p));
-               SAFE_FREE(tmp);
-               return result;
        }
 
-
-       result.ip = *interpret_addr2(tmp);
        SAFE_FREE(tmp);
        return result;
 }

Reply via email to