Diff for /libaitio/src/aitio.c between versions 1.1 and 1.2

version 1.1, 2010/02/23 22:54:52 version 1.2, 2010/09/10 12:39:41
Line 9 Line 9
 #include "global.h"  #include "global.h"
   
   
   int io_Debug;
   
   
 #pragma GCC visibility push(hidden)  #pragma GCC visibility push(hidden)
   
 int io_Errno;  int io_Errno;
Line 302  char *ioRegexReplace(const char *csRegex, const char * Line 305  char *ioRegexReplace(const char *csRegex, const char *
   
         return str;          return str;
 }  }
   
   
   /*
    * ioMkDir() Function for racursive directory creation and validation
    * @csDir = Full directory path
    * @mode = Mode for directory creation if missing dir
    * return: -1 error, 0 directory path exist, >0 created missing dirs
   */
   int
   ioMkDir(const char *csDir, int mode)
   {
           char *str, *s, *pbrk, szOld[MAXPATHLEN] = { 0 };
           register int cx = -1;
   
           if (!csDir)
                   return cx;
   
           str = strdup(csDir);
           if (!str) {
                   LOGERR;
                   return cx;
           }
   
           getcwd(szOld, MAXPATHLEN);
           if (*str == '/')
                   chdir("/");
   
           for (cx = 0, s = strtok_r(str, "/", &pbrk); s; s = strtok_r(NULL, "/", &pbrk)) {
                   if (mkdir(s, mode) == -1) {
                           if (errno != EEXIST) {
                                   LOGERR;
                                   cx = -1;
                                   goto end;
                           }
                   } else
                           cx++;
   
                   if (chdir(s) == -1) {
                           LOGERR;
                           cx = -1;
                           goto end;
                   }
           }
   end:
           chdir(szOld);
           free(str);
           return cx;
   }
   

Removed from v.1.1  
changed lines
  Added in v.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>