diff options
| author | Markus Uhlin <markus@nifty-networks.net> | 2026-03-07 22:16:12 +0100 |
|---|---|---|
| committer | Markus Uhlin <markus@nifty-networks.net> | 2026-03-07 22:16:12 +0100 |
| commit | 16bb8d07c235e9ba35ff897be9a59e3cc7cbdc79 (patch) | |
| tree | 814d822abfcdc616da6d8b2851c5e497021f2d4b /FICS | |
| parent | 20f14b0535210d92e410e81f6db5c4e17b578991 (diff) | |
Changed psend_command()
Diffstat (limited to 'FICS')
| -rw-r--r-- | FICS/utils.c | 10 |
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 * |
