commit 16bb8d07c235e9ba35ff897be9a59e3cc7cbdc79 from: Markus Uhlin date: Sat Mar 7 21:16:12 2026 UTC Changed psend_command() commit - 20f14b0535210d92e410e81f6db5c4e17b578991 commit + 16bb8d07c235e9ba35ff897be9a59e3cc7cbdc79 blob - 38c7a81414b89c6734f11e574b83f20ef8715498 blob + 0b44afa542258dccd3bd55e226bd3dd398a74e18 --- FICS/utils.c +++ 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 *