diff options
author | kwc@citi.umich.edu <kwc@citi.umich.edu> | 2006-07-03 18:34:38 -0400 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2006-07-04 10:27:15 +1000 |
commit | 1f1b05a65ef3dc6597c7bc1e2a38f38ae95bf230 (patch) | |
tree | 1cd03c05ff0aaa0afb06b0f0f97538792136f025 /utils/gssd/cacheio.c | |
parent | ee664fd246d77010af13fb557407c612752a5ea8 (diff) | |
download | nfs-utils-1f1b05a65ef3dc6597c7bc1e2a38f38ae95bf230.tar.gz nfs-utils-1f1b05a65ef3dc6597c7bc1e2a38f38ae95bf230.tar.xz nfs-utils-1f1b05a65ef3dc6597c7bc1e2a38f38ae95bf230.zip |
Properly report errors in readline() function
Signed-off-by: Kevin Coffman <kwc@citi.umich.edu>
Change message priorities for errors and debug messages.
Diffstat (limited to 'utils/gssd/cacheio.c')
-rw-r--r-- | utils/gssd/cacheio.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/utils/gssd/cacheio.c b/utils/gssd/cacheio.c index 07658e9..75c7a5d 100644 --- a/utils/gssd/cacheio.c +++ b/utils/gssd/cacheio.c @@ -55,6 +55,7 @@ #include <time.h> #include <stdlib.h> #include <string.h> +#include <errno.h> #include "err_util.h" void qword_add(char **bpp, int *lp, char *str) @@ -264,7 +265,8 @@ int readline(int fd, char **buf, int *lenp) } len = read(fd, *buf, *lenp); if (len <= 0) { - printerr(2, "read error in readline: %d\n", len); + printerr(0, "readline: read error: len %d errno %d (%s)\n", + len, errno, strerror(errno)); return 0; } while ((*buf)[len-1] != '\n') { @@ -280,12 +282,14 @@ int readline(int fd, char **buf, int *lenp) *buf = new; nl = read(fd, *buf +len, *lenp - len); if (nl <= 0 ) { - printerr(2, "read error in readline: %d\n", nl); + printerr(0, "readline: read error: len %d " + "errno %d (%s)\n", nl, errno, strerror(errno)); return 0; } len += nl; } (*buf)[len-1] = 0; - printerr(1, "read line with %d characters:\n%s\n", *lenp, *buf); + printerr(3, "readline: read %d chars into buffer of size %d:\n%s\n", + len, *lenp, *buf); return 1; } |