-rw-r--r-- | cgit.h | 1 | ||||
-rw-r--r-- | shared.c | 7 |
2 files changed, 8 insertions, 0 deletions
@@ -159,2 +159,3 @@ extern int chk_zero(int result, char *msg); extern int chk_positive(int result, char *msg); +extern int chk_non_negative(int result, char *msg); @@ -88,2 +88,9 @@ int chk_positive(int result, char *msg) +int chk_non_negative(int result, char *msg) +{ + if (result < 0) + die("%s: %s",msg, strerror(errno)); + return result; +} + struct repoinfo *add_repo(const char *url) |