Mail Archives: djgpp-workers/1999/08/08/09:11:51
Richard Dawe wrote:
>
> Hello.
>
> I've just produced the latest snapshot of zippo. This is the first useful
> version IMO. It supports the following:
Hello,
I got the sources & compiled them. When I run
"zippo --initdb --root c:/djgpp" zippo threw out
"access denied" error. It was caused by bug in recursive_mkdir():
if pathname has drive letter, at first it tries to create "c:"
directory. I fixed that bug, also rewrote expression
*p = '\0', ret = mkdir(buf, mode), *p = '/';
to use ";" instead of ",", because GCC could reorder that
expression as it likes and that would result in a big bug.
Also I added S_IWUSR to mkdir()'s modes which I found because
according to DJGPP docs without that flag mkdir() creates
read-only directories.
Last note - in docs you mentioned that configure script
not always finds GCC. You seem to be using autoconf 2.12,
I suggest to update to 2.13 and the problem should vanish.
Also I added AC_PROG_CC call to configure.in.
Bye,
Laurynas Biveinis
--------------------
diff -u -r z990807s/configure.in z990807s.my/configure.in
--- z990807s/configure.in Sat Aug 7 16:43:54 1999
+++ z990807s.my/configure.in Sun Aug 8 14:05:36 1999
@@ -2,6 +2,8 @@
dnl Copyright 1999 by Richard Dawe
dnl
AC_INIT(zippo.c)
+dnl --- Check for programs
+AC_PROG_CC
dnl --- Check for libraries
AC_CHECK_LIB(mss, mss_startup)
AC_CHECK_LIB(socket, socket)
diff -u -r z990807s/util.c z990807s.my/util.c
--- z990807s/util.c Sat Aug 7 16:44:02 1999
+++ z990807s.my/util.c Sun Aug 8 14:35:54 1999
@@ -199,12 +199,20 @@
char *p = NULL;
int i, ret;
- for (p = buf, i = 0; (p = strchr(p + 1, '/')) != NULL; ) {
+ // LB: added detection of paths with drive letters
+ if (buf[1] == ':')
+ p = &buf[2];
+ else
+ p = &buf[0];
+
+ for (i = 0; (p = strchr(p + 1, '/')) != NULL; ) {
/* Quit if it's a trailing slash */
if (*p == '\0') break;
/* Chop up temporarily & create a component. */
- *p = '\0', ret = mkdir(buf, mode), *p = '/';
+ *p = '\0';
+ ret = mkdir(buf, mode);
+ *p = '/';
if ((ret != 0) && (errno != EEXIST)) {
/* Pass down error */
diff -u -r z990807s/zippo.c z990807s.my/zippo.c
--- z990807s/zippo.c Sat Aug 7 16:44:02 1999
+++ z990807s.my/zippo.c Sun Aug 8 14:50:32 1999
@@ -1144,7 +1144,7 @@
/* Make sure the prefix exists */
printf(". Creating prefix directory '%s'...", prefix);
- mode = S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH;
+ mode = S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH | S_IWUSR;
ret = recursive_mkdir(prefix, mode);
if ((ret != 0) && (errno != EEXIST)) {
@@ -1307,7 +1307,7 @@
strcpy(path, share_path);
printf(". Creating database structure in '%s'...", path);
- mode = S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH;
+ mode = S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH | S_IWUSR;
ret = recursive_mkdir(path, mode);
ret = (ret == 0) && recursive_mkdir(db_path, mode);
ret = (ret == 0) && recursive_mkdir(db_avail_path, mode);
- Raw text -