diff options
author | 2009-02-23 06:28:52 +1000 | |
---|---|---|
committer | 2009-02-23 06:28:52 +1000 | |
commit | 14c84ffbcbbe0368e61b7bc59d44a1d7bc906d33 (patch) | |
tree | a0fbafe2d63e86d5adcd615a7bc70fade00f0803 /print_help.c | |
parent | f71c6f3f0e34c034c3dec54289527a68a136749f (diff) |
Check return value of a few write calls and retry on EINTR, and fix a few other warnings, mostly by printing error messages before giving up.
darcs-hash:20090222202852-ac50b-b0e79142af5b7a99e55271d4001fa252d9684a1d.gz
Diffstat (limited to 'print_help.c')
-rw-r--r-- | print_help.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/print_help.c b/print_help.c index 72344cde..06270d20 100644 --- a/print_help.c +++ b/print_help.c @@ -5,18 +5,26 @@ #include <stdlib.h> #include <stdio.h> - +#include <string.h> #include "print_help.h" #define CMD_LEN 1024 +#define HELP_ERR "Could not show help message\n" + void print_help( char *c, int fd ) { char cmd[ CMD_LEN]; int printed = snprintf( cmd, CMD_LEN, "fish -c '__fish_print_help %s >&%d'", c, fd ); if( printed < CMD_LEN ) - system( cmd ); + { + if( (system( cmd ) == -1) ) + { + write_loop(2, HELP_ERR, strlen(HELP_ERR)); + } + } + } |