From: Mark Atwood Date: Tue, 16 Oct 2007 21:03:36 +0000 (-0700) Subject: command line error reporting, use my_errno X-Git-Tag: 0.7~26^2 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=a31dec59186e1a262a9a815b125e3c7005ce08b2;p=awesomized%2Flibmemcached command line error reporting, use my_errno --- diff --git a/lib/memcached_strerror.c b/lib/memcached_strerror.c index 587ac862..5ebeebf6 100644 --- a/lib/memcached_strerror.c +++ b/lib/memcached_strerror.c @@ -55,7 +55,7 @@ char *memcached_strerror(memcached_st *ptr, memcached_return rc) case MEMCACHED_STAT: return "STAT VALUE"; case MEMCACHED_ERRNO: - return "UNKOWN ERROR SEE MY_ERRNO"; + return "SYSTEM ERROR"; case MEMCACHED_MAXIMUM_RETURN: return "Gibberish returned!"; default: diff --git a/src/memcat.c b/src/memcat.c index 59d4a871..057a585c 100644 --- a/src/memcat.c +++ b/src/memcat.c @@ -69,8 +69,11 @@ int main(int argc, char *argv[]) } else if (rc != MEMCACHED_NOTFOUND) { - fprintf(stderr, "memcat: %s: memcache error %s\n", + fprintf(stderr, "memcat: %s: memcache error %s", argv[optind], memcached_strerror(memc, rc)); + if (memc->my_errno) + fprintf(stderr, " system error %s", strerror(memc->my_errno)); + fprintf(stderr, "\n"); } optind++; } diff --git a/src/memcp.c b/src/memcp.c index 8f505eb3..0eb210a7 100644 --- a/src/memcp.c +++ b/src/memcp.c @@ -116,8 +116,13 @@ int main(int argc, char *argv[]) opt_expires, opt_flags); if (rc != MEMCACHED_SUCCESS) - fprintf(stderr, "memcp: %s: memcache error %s\n", + { + fprintf(stderr, "memcp: %s: memcache error %s", ptr, memcached_strerror(memc, rc)); + if (memc->my_errno) + fprintf(stderr, " system error %s", strerror(memc->my_errno)); + fprintf(stderr, "\n"); + } free(file_buffer_ptr); close(fd); diff --git a/src/memflush.c b/src/memflush.c index 657a782d..075875a2 100644 --- a/src/memflush.c +++ b/src/memflush.c @@ -43,8 +43,11 @@ int main(int argc, char *argv[]) rc = memcached_flush(memc, opt_expire); if (rc != MEMCACHED_SUCCESS) { - fprintf(stderr, "memflush: memcache error %s\n", + fprintf(stderr, "memflush: memcache error %s", memcached_strerror(memc, rc)); + if (memc->my_errno) + fprintf(stderr, " system error %s", strerror(memc->my_errno)); + fprintf(stderr, "\n"); } memcached_free(memc); diff --git a/src/memrm.c b/src/memrm.c index 77416c95..acfbf53f 100644 --- a/src/memrm.c +++ b/src/memrm.c @@ -48,8 +48,11 @@ int main(int argc, char *argv[]) if (rc != MEMCACHED_SUCCESS) { - fprintf(stderr, "memrm: %s: memcache error %s\n", + fprintf(stderr, "memrm: %s: memcache error %s", argv[optind], memcached_strerror(memc, rc)); + if (memc->my_errno) + fprintf(stderr, " system error %s", strerror(memc->my_errno)); + fprintf(stderr, "\n"); } optind++;