]> granicus.if.org Git - zziplib/commitdiff
cut out _mkdir to zzip/__mkdir.h and use bin/*.c as well
authorGuido Draheim <guidod@gmx.de>
Mon, 12 Jun 2017 00:04:42 +0000 (02:04 +0200)
committerGuido Draheim <guidod@gmx.de>
Mon, 12 Jun 2017 00:04:42 +0000 (02:04 +0200)
bins/unzzipcat-big.c
bins/unzzipcat-mem.c
bins/unzzipcat-mix.c
bins/unzzipcat-zip.c
zzip/Makefile.am
zzip/Makefile.in
zzip/__mkdir.h [new file with mode: 0644]
zzip/write.c

index 5b004763854ae30bc018cd7ad196bc4a5770f135..d2d6d0c51718f66ec942679713d58d824d1dcd5d 100644 (file)
@@ -9,6 +9,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
+#include <zzip/__mkdir.h>
 #include <zzip/__string.h>
 #include <zzip/__debug.h>
 #include "unzzipcat-zip.h"
@@ -59,7 +60,7 @@ static void makedirs(const char* name)
           makedirs(dir_name);
           free (dir_name);
       } else {
-          mkdir(name, 775);
+          _zzip_mkdir(name, 775);
           errno = 0;
       }
 }
index 3f30e8dc8c725243f91a66d826e742fbcc285f30..2865ea55d1a1de4c065b3dcdaf3d837e1eef9374 100644 (file)
@@ -10,6 +10,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
+#include <zzip/__mkdir.h>
 #include <zzip/__string.h>
 #include "unzzipcat-zip.h"
 
@@ -63,7 +64,7 @@ static void makedirs(const char* name)
           makedirs(dir_name);
           free (dir_name);
       } else {
-          mkdir(name, 775);
+          _zzip_mkdir(name, 775);
           errno = 0;
       }
 }
index fde678477cf5f55d739905965aa3cdbaa016747a..feb2b3aa332fbeff5108038a24da540f8c2a31ac 100644 (file)
@@ -10,6 +10,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
+#include <zzip/__mkdir.h>
 #include <zzip/__string.h>
 #include "unzzipcat-zip.h"
 
@@ -49,7 +50,7 @@ static void makedirs(const char* name)
           makedirs(dir_name);
           free (dir_name);
       } else {
-          mkdir(name, 775);
+          _zzip_mkdir(name, 775);
           errno = 0;
       }
 }
index 9ad9fcbdc7e85f2964953049d3d2de88d80a9ba2..219ef8e5fad50bf565918f22aac7a581cbe131ed 100644 (file)
@@ -10,6 +10,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
+#include <zzip/__mkdir.h>
 #include <zzip/__string.h>
 #include "unzzipcat-zip.h"
 
@@ -49,7 +50,7 @@ static void makedirs(const char* name)
           makedirs(dir_name);
           free (dir_name);
       } else {
-          mkdir(name, 775);
+          _zzip_mkdir(name, 775);
           errno = 0;
       }
 }
index db75a75f9eefe34f99193367a1f8eca1d62f592e..b3c99125a840b88b8e42d3df48771c964600d305 100644 (file)
@@ -8,7 +8,7 @@ zzipdir = ${includedir}/zzip
 zzip_HEADERS = $(libzzip_la_headers) \
                $(libzzipmmapped_la_headers) \
                $(libzzipfseeko_la_headers)
-noinst_HEADERS = __debug.h __hints.h __mmap.h __dirent.h __fnmatch.h __string.h
+noinst_HEADERS = __debug.h __hints.h __mmap.h __dirent.h __fnmatch.h __string.h __mkdir.h
 #
 VERSION_INFO=@VERSION_INFO@
 RELEASE_INFO=@RELEASE_INFO@
index b4b74ad2d85a5e880042139b6c4942af1d837fff..3d76e350746a83f4dafef69804df5968ba7eaf0b 100644 (file)
@@ -397,7 +397,7 @@ zzip_HEADERS = $(libzzip_la_headers) \
                $(libzzipmmapped_la_headers) \
                $(libzzipfseeko_la_headers)
 
-noinst_HEADERS = __debug.h __hints.h __mmap.h __dirent.h __fnmatch.h __string.h
+noinst_HEADERS = __debug.h __hints.h __mmap.h __dirent.h __fnmatch.h __string.h __mkdir.h
 #
 libzzip_la_SOURCES = \
        zip.c \
diff --git a/zzip/__mkdir.h b/zzip/__mkdir.h
new file mode 100644 (file)
index 0000000..c1bffa4
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef __ZZIP_INTERNAL_MKDIR_H
+#define __ZZIP_INTERNAL_MKDIR_H
+
+#include <zzip/conf.h>
+
+#  ifdef ZZIP_HAVE_DIRECT_H
+#  define _zzip_mkdir(a,b) mkdir(a)
+#  else
+#  define _zzip_mkdir      mkdir
+#  endif
+
+#endif
index cc09c5b9e81ed8a1698fd5f818fd1e060bfdc193..d2f715c449acf56d91c694a0609440c12a8aff37 100644 (file)
@@ -1,4 +1,3 @@
-
 /*
  * The write-support in zziplib is not a full-flegded interface to the
  * internals that zip file-header or zip archive an contain. It's
@@ -43,6 +42,7 @@
 
 #include <zzip/format.h>
 #include <zzip/plugin.h>
+#include <zzip/__mkdir.h>
 #include <zzip/__debug.h>
 
 #define ___ {
 #  define S_IRWXO 00007
 #  endif
 
-#  ifdef ZZIP_HAVE_DIRECT_H
-#  define _mkdir(a,b) mkdir(a)
-#  else
-#  define _mkdir      mkdir
-#  endif
-
 /** create a new zip archive for writing
  *
  * This function will create a new zip archive. The returned parameter 
@@ -136,7 +130,7 @@ zzip_dir_creat_ext_io(zzip_char_t * name, int o_mode,
         /* not implemented - however, we respect that a null argument to 
          * zzip_mkdir and zzip_creat works, so we silently still do the mkdir 
          */
-        if (! _mkdir(name, o_mode) || errno == EEXIST)
+        if (! _zzip_mkdir(name, o_mode) || errno == EEXIST)
             errno = EROFS;
         return 0;
     } else
@@ -218,7 +212,7 @@ zzip_createdir(zzip_char_t * name, int o_mode)
 {
     if (o_mode & S_IWGRP)
     {
-        if (-1 == _mkdir(name, o_mode) && errno != EEXIST)      /* fail */
+        if (-1 == _zzip_mkdir(name, o_mode) && errno != EEXIST)      /* fail */
             return 0;
         return zzip_opendir(name);
     } else
@@ -261,7 +255,7 @@ int
 zzip_file_mkdir(ZZIP_DIR * dir, zzip_char_t * name, int o_mode)
 {
     if (! dir)
-        return _mkdir(name, o_mode);
+        return _zzip_mkdir(name, o_mode);
 
     if (! _ZZIP_TRY)
     {                           /* not implemented */