/*
* Utility routines.
*
- * Copyright (C) tons of folks. Tracking down who wrote what
- * isn't something I'm going to worry about... If you wrote something
- * here, please feel free to acknowledge your work.
+ * Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Based in part on code from sash, Copyright (c) 1999 by David I. Bell
- * Permission has been granted to redistribute this code under the GPL.
- *
*/
#include <stdio.h>
/* For Erik's nifty devps device driver */
-#ifdef BB_FEATURE_USE_DEVPS_PATCH
+#ifdef CONFIG_FEATURE_USE_DEVPS_PATCH
#include <linux/devps.h>
/* find_pid_by_name()
pidList[j++]=info.pid;
}
}
- if (pidList)
+ if (pidList) {
pidList[j]=0;
+ } else if ( strcmp(pidName, "init")==0) {
+ /* If we found nothing and they were trying to kill "init",
+ * guess PID 1 and call it good... Perhaps we should simply
+ * exit if /proc isn't mounted, but this will do for now. */
+ pidList=xrealloc( pidList, sizeof(pid_t));
+ pidList[0]=1;
+ } else {
+ pidList=xrealloc( pidList, sizeof(pid_t));
+ pidList[0]=-1;
+ }
/* Free memory */
free( pid_array);
return pidList;
}
-#else /* BB_FEATURE_USE_DEVPS_PATCH */
+#else /* CONFIG_FEATURE_USE_DEVPS_PATCH */
/* find_pid_by_name()
*
if (pidList)
pidList[i]=0;
- else {
- /* If we found nothing, guess PID 1 and call it good */
+ else if ( strcmp(pidName, "init")==0) {
+ /* If we found nothing and they were trying to kill "init",
+ * guess PID 1 and call it good... Perhaps we should simply
+ * exit if /proc isn't mounted, but this will do for now. */
pidList=xrealloc( pidList, sizeof(pid_t));
pidList[0]=1;
+ } else {
+ pidList=xrealloc( pidList, sizeof(pid_t));
+ pidList[0]=-1;
}
return pidList;
}
-#endif /* BB_FEATURE_USE_DEVPS_PATCH */
+#endif /* CONFIG_FEATURE_USE_DEVPS_PATCH */
/* END CODE */
/*