chiark / gitweb /
Handle opening errors in gzopen properly 3.1
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Fri, 14 Aug 2009 19:09:57 +0000 (20:09 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Fri, 14 Aug 2009 19:09:57 +0000 (20:09 +0100)
yarrg/common.c

index f95e585866657f8d8e29c19c7c31b5daeae9c977..cc33235f2b11d2fab791a7376113ac56d05002d6 100644 (file)
@@ -122,7 +122,7 @@ int gzopen(const char *zpath, int oflags, FILE **f_r, pid_t *pid_r,
           const char *gziplevel /* 0 for read; may be 0, or "-1" etc. */) {
 
   int zfd= open(zpath, oflags, 0666);
-  if (!zfd) return errno;
+  if (zfd<0) return errno;
 
   int pipefds[2];
   sysassert(! pipe(pipefds) );