aboutsummaryrefslogtreecommitdiffstats
path: root/FICS
diff options
context:
space:
mode:
Diffstat (limited to 'FICS')
-rw-r--r--FICS/utils.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/FICS/utils.c b/FICS/utils.c
index 38c7a81..0b44afa 100644
--- a/FICS/utils.c
+++ b/FICS/utils.c
@@ -662,11 +662,16 @@ psend_command(int p, char *command, char *input)
char tmp[MAX_LINE_SIZE];
int num;
+ if (command == NULL || strcmp(command, "") == 0) {
+ warnx("%s: error: no command", __func__);
+ return -1;
+ }
+
if (input)
fp = popen(command, "w");
else
fp = popen(command, "r");
- if (!fp)
+ if (fp == NULL)
return -1;
if (input) {
@@ -679,8 +684,7 @@ psend_command(int p, char *command, char *input)
}
}
- pclose(fp);
- return 0;
+ return (pclose(fp) == -1 ? -1 : 0);
}
PUBLIC char *