projects
/
rrdtool.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* patches to make rrdtool compile on win32 (trunk and 1.4)
[rrdtool.git]
/
src
/
rrd_utils.c
diff --git
a/src/rrd_utils.c
b/src/rrd_utils.c
index
6853c66
..
3c4930f
100644
(file)
--- a/
src/rrd_utils.c
+++ b/
src/rrd_utils.c
@@
-25,19
+25,24
@@
#include <assert.h>
#include <errno.h>
#include <assert.h>
#include <errno.h>
-#include <libgen.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
+#ifndef _MSC_VER
+#include <libgen.h>
#include <unistd.h>
#include <unistd.h>
-
+#endif
#ifdef WIN32
# define random() rand()
# define srandom(x) srand(x)
# define getpid() 0
#endif /* WIN32 */
#ifdef WIN32
# define random() rand()
# define srandom(x) srand(x)
# define getpid() 0
#endif /* WIN32 */
+#ifndef S_ISDIR
+#define S_ISDIR(x) (((x) & S_IFMT) == S_IFDIR)
+#endif
+
/* make sure that the random number generator seeded EXACTLY ONCE */
long rrd_random(void)
{
/* make sure that the random number generator seeded EXACTLY ONCE */
long rrd_random(void)
{
@@
-171,7
+176,11
@@
int rrd_mkdir_p(const char *pathname, mode_t mode)
if (NULL == (pathname_copy = strdup(pathname)))
return -1;
if (NULL == (pathname_copy = strdup(pathname)))
return -1;
+#ifndef _MSC_VER
base_dir = dirname(pathname_copy);
base_dir = dirname(pathname_copy);
+#else
+ _splitpath(pathname_copy, NULL, base_dir, NULL, NULL);
+#endif
if (0 != rrd_mkdir_p(base_dir, mode)) {
int orig_errno = errno;
if (0 != rrd_mkdir_p(base_dir, mode)) {
int orig_errno = errno;
@@
-183,8
+192,13
@@
int rrd_mkdir_p(const char *pathname, mode_t mode)
free(pathname_copy);
/* keep errno as set by mkdir() */
free(pathname_copy);
/* keep errno as set by mkdir() */
+#ifdef _MSC_VER
+ if (0 != mkdir(pathname))
+ return -1;
+#else
if (0 != mkdir(pathname, mode))
return -1;
if (0 != mkdir(pathname, mode))
return -1;
+#endif
return 0;
} /* rrd_mkdir_p */
return 0;
} /* rrd_mkdir_p */