X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=util%2Fyaz-xmlquery.c;h=76a11a95589b2e21c91c190859b853fa9bf84cbf;hb=e709ab8b395212d2d3d12ad215a3aa2272654c62;hp=b40ddaff80c14487a1a99bfcb6e6db90284938ee;hpb=ee6ab2ee3a9ee1a8c65d7272ec7fba1d886f5af0;p=yaz-moved-to-github.git diff --git a/util/yaz-xmlquery.c b/util/yaz-xmlquery.c index b40ddaf..76a11a9 100644 --- a/util/yaz-xmlquery.c +++ b/util/yaz-xmlquery.c @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2008 Index Data + * Copyright (C) 1995-2009 Index Data * See the file LICENSE for details. */ @@ -72,7 +72,13 @@ void pqftoxmlquery(const char *pqf) exit(4); } else - fwrite(buf_out, len_out, 1, stdout); + { + if (fwrite(buf_out, len_out, 1, stdout) != 1) + { + fprintf(stderr, "%s: write failed\n", prog); + exit(5); + } + } xmlFreeDoc(doc); } } @@ -143,8 +149,16 @@ void xmlfiletopqf(const char *xmlfile) rewind(f); xmlstr = (char *) xmalloc(sz+1); xmlstr[sz] = '\0'; - fread(xmlstr, sz, 1, f); - fclose(f); + if (fread(xmlstr, sz, 1, f) != 1) + { + fprintf(stderr, "%s: read failed for file %s\n", prog, xmlfile); + exit(1); + } + if (fclose(f)) + { + fprintf(stderr, "%s: close failed for file %s\n", prog, xmlfile); + exit(1); + } xmlquerytopqf(xmlstr); xfree(xmlstr);