pkg://procps-2.0.7-11.src.rpm:212926/procps-2.0.7-retcode.patch
info downloads
--- procps-2.0.7/sysctl.c.retcode Thu Feb 1 14:09:42 2001
+++ procps-2.0.7/sysctl.c Thu Feb 1 14:21:21 2001
@@ -40,7 +40,7 @@
* Function Prototypes
*/
int Usage(const char *name);
-void Preload(const char *filename);
+int Preload(const char *filename);
int WriteSetting(const char *setting);
int ReadSetting(const char *setting);
int DisplayAll(const char *path, bool ShowTableUtil);
@@ -102,8 +102,7 @@
preloadfile = *argv;
} /* endif */
- Preload(preloadfile);
- return(0);
+ return Preload(preloadfile);
break;
case 'a':
case 'A':
@@ -120,7 +119,8 @@
SwitchesAllowed = false;
if (WriteMode)
ReturnCode = WriteSetting(*argv);
- else ReadSetting(*argv);
+ else
+ ReturnCode = ReadSetting(*argv);
} /* end if */
} /* end for */
@@ -176,17 +176,18 @@
* - we parse the file and then reform it (strip out whitespace)
*
*/
-void Preload(const char *filename) {
+int Preload(const char *filename) {
FILE *fp;
char oneline[257];
char buffer[257];
char *t;
int n = 0;
+int rc = 0, i;
char *name, *value;
if (!filename || ((fp = fopen(filename, "r")) == NULL)) {
fprintf(stderr, ERR_PRELOAD_FILE, filename);
- return;
+ return -1;
} /* endif */
while (fgets(oneline, 256, fp)) {
@@ -218,10 +219,12 @@
value++;
sprintf(buffer, "%s=%s", name, value);
- WriteSetting(buffer);
+ i = WriteSetting(buffer);
+ rc = rc ? rc : i;
} /* endwhile */
fclose(fp);
+ return rc;
} /* end Preload() */