1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-12 12:23:50 +03:00

use -1 not 0xffffffff in SIVALS() macros

use the same process_exists() code on all systems (it's probably
faster anyway)
This commit is contained in:
Andrew Tridgell
-
parent e360c79c9c
commit 901b95aa77
2 changed files with 5 additions and 27 deletions

View File

@@ -3779,29 +3779,7 @@ check if a process exists. Does this work on all unixes?
****************************************************************************/
BOOL process_exists(int pid)
{
#ifdef LINUX
fstring s;
sprintf(s,"/proc/%d",pid);
return(directory_exist(s,NULL));
#else
{
static BOOL tested=False;
static BOOL ok=False;
fstring s;
if (!tested) {
tested = True;
sprintf(s,"/proc/%05d",(int)getpid());
ok = file_exist(s,NULL);
}
if (ok) {
sprintf(s,"/proc/%05d",pid);
return(file_exist(s,NULL));
}
}
/* CGH 8/16/96 - added ESRCH test */
return(pid == getpid() || kill(pid,0) == 0 || errno != ESRCH);
#endif
return(kill(pid,0) == 0 || errno != ESRCH);
}