aboutsummaryrefslogtreecommitdiff
path: root/src/main/extractor_common.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-07-30 14:46:36 +0000
committerChristian Grothoff <christian@grothoff.org>2012-07-30 14:46:36 +0000
commitb57601ab81464c1539f14a763f35fccba751f6c1 (patch)
treef35a18a139b4dbcf690ac48308ada78ca46f664c /src/main/extractor_common.c
parent9cb851a3d59e4287837d3a49699e60d0494af6a4 (diff)
downloadlibextractor-b57601ab81464c1539f14a763f35fccba751f6c1.tar.gz
libextractor-b57601ab81464c1539f14a763f35fccba751f6c1.zip
adding logging
Diffstat (limited to 'src/main/extractor_common.c')
-rw-r--r--src/main/extractor_common.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/main/extractor_common.c b/src/main/extractor_common.c
index 3b7f1d7..08a32e4 100644
--- a/src/main/extractor_common.c
+++ b/src/main/extractor_common.c
@@ -17,9 +17,14 @@
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19 */ 19 */
20 20/**
21 * @file main/extractor_common.c
22 * @brief commonly used functions within the library
23 * @author Christian Grothoff
24 */
21#include "platform.h" 25#include "platform.h"
22#include "extractor_common.h" 26#include "extractor_common.h"
27#include "extractor_logging.h"
23#include "extractor.h" 28#include "extractor.h"
24#include <sys/types.h> 29#include <sys/types.h>
25#include <signal.h> 30#include <signal.h>
@@ -48,7 +53,11 @@ EXTRACTOR_write_all_ (int fd,
48 { 53 {
49 ret = write (fd, &data[off], size - off); 54 ret = write (fd, &data[off], size - off);
50 if (ret <= 0) 55 if (ret <= 0)
51 return -1; 56 {
57 if (-1 == ret)
58 LOG_STRERROR ("write");
59 return -1;
60 }
52 off += ret; 61 off += ret;
53 } 62 }
54 return size; 63 return size;
@@ -76,7 +85,11 @@ EXTRACTOR_read_all_ (int fd,
76 { 85 {
77 ret = read (fd, &data[off], size - off); 86 ret = read (fd, &data[off], size - off);
78 if (ret <= 0) 87 if (ret <= 0)
79 return -1; 88 {
89 if (-1 == ret)
90 LOG_STRERROR ("write");
91 return -1;
92 }
80 off += ret; 93 off += ret;
81 } 94 }
82 return size; 95 return size;