rpms/SysVinit/devel sysvinit-2.85-fixscripts.patch,1.2,1.3

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Thu Jun 30 21:19:05 UTC 2005


Author: notting

Update of /cvs/dist/rpms/SysVinit/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv27440

Modified Files:
	sysvinit-2.85-fixscripts.patch 
Log Message:
fix the fix

sysvinit-2.85-fixscripts.patch:
 killall5.c |   45 ++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 40 insertions(+), 5 deletions(-)

Index: sysvinit-2.85-fixscripts.patch
===================================================================
RCS file: /cvs/dist/rpms/SysVinit/devel/sysvinit-2.85-fixscripts.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- sysvinit-2.85-fixscripts.patch	30 Jun 2005 20:04:12 -0000	1.2
+++ sysvinit-2.85-fixscripts.patch	30 Jun 2005 21:19:03 -0000	1.3
@@ -1,16 +1,15 @@
 --- sysvinit-2.85/src/killall5.c.fixscripts	2005-06-30 09:42:52.000000000 -0400
-+++ sysvinit-2.85/src/killall5.c	2005-06-30 10:13:34.000000000 -0400
-@@ -50,6 +50,9 @@
++++ sysvinit-2.85/src/killall5.c	2005-06-30 17:01:40.000000000 -0400
+@@ -50,6 +50,8 @@
    char *fullname;	/* Name as found out from argv[0] */
    char *basename;	/* Only the part after the last / */
    char *statname;	/* the statname without braces    */
 +  char *scriptname;     /* (potential) script name	  */
-+  char *scriptpath;	/* (potential) script dir	  */
 +       
    pid_t pid;		/* Process ID.			  */
    int sid;		/* Session ID.			  */
    struct _proc_ *next;	/* Pointer to next struct. 	  */
-@@ -177,6 +180,7 @@
+@@ -177,6 +179,7 @@
  
  	/* Walk through the directory. */
  	while ((d = readdir(dir)) != NULL) {
@@ -18,7 +17,7 @@
  
  		/* See if this is a process */
  		if ((pid = atoi(d->d_name)) == 0) continue;
-@@ -235,13 +239,13 @@
+@@ -235,13 +238,13 @@
  		}
  
  		/* Now read argv[0] */
@@ -33,7 +32,7 @@
  
  			/* Store the name into malloced memory. */
  			p->fullname = (char *)xmalloc(f);
-@@ -252,12 +256,28 @@
+@@ -252,12 +255,31 @@
  				p->basename++;
  			else
  				p->basename = p->fullname;
@@ -53,27 +52,28 @@
 +		snprintf(path, sizeof(path), "/proc/%s/cwd", d->d_name);
 +		memset(cwd,'\0',sizeof(cwd));
 +		if (tmparg[0] && readlink(path, cwd, PATH_MAX) != -1) {
-+			p->scriptname = strdup(tmparg);
-+			p->scriptpath = strdup(cwd);
++			if (tmparg[0] != '/') {
++				p->scriptname = (char *)xmalloc(PATH_MAX);
++				snprintf(p->scriptname,PATH_MAX-1,"%s/%s",cwd,tmparg);
++			} else {
++				p->scriptname = strdup(tmparg);
++			}
 +		} else {
 +			p->scriptname = NULL;
-+			p->scriptpath = NULL;
 +		}
  
  		/* Try to stat the executable. */
  		snprintf(path, sizeof(path), "/proc/%s/exe", d->d_name);
-@@ -324,6 +344,18 @@
+@@ -324,6 +346,16 @@
  	return NULL;
  }
  
-+int check_realpath(char *dir, char *entry, char *check)
++int check_realpath(char *entry, char *target)
 +{
-+	char tmp[PATH_MAX], *path;
++	char *path;
 +	
-+	memset(tmp,'\0',sizeof(tmp));
-+	snprintf(tmp,255,"%s/%s", dir, entry);
-+	path = canonicalize_file_name(tmp);
-+	if (path && !strcmp(path, check))
++	path = canonicalize_file_name(entry);
++	if (path && !strcmp(path, target))
 +		return 1;
 +	return 0;
 +}
@@ -104,7 +104,7 @@
 +			if (!ok) continue;
 +			
 +			if (prog[0] == '/' && p->pathname && strcmp(prog,p->pathname) &&
-+			    !(!strcmp(p->statname,s) && check_realpath(p->scriptpath, p->scriptname, prog)))
++			    !(!strcmp(p->statname,s) && check_realpath(p->scriptname, prog)))
  				ok = 0;
  
  			if (ok) add_pid_to_q(q, p);




More information about the fedora-cvs-commits mailing list