gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnunet] branch master updated: config file writting silent


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated: config file writting silent bugg (when directory doesnt give write access) fix
Date: Sun, 24 Jun 2018 19:44:17 +0200

This is an automated email from the git hooks/post-receive script.

erwan-ulrich pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 8a719470e config file writting silent bugg (when directory doesnt give 
write access) fix
8a719470e is described below

commit 8a719470e23bf5a81058077ab59c6c29e85f0fc8
Author: Feideus <address@hidden>
AuthorDate: Sun Jun 24 19:41:51 2018 +0200

    config file writting silent bugg (when directory doesnt give write access) 
fix
---
 src/util/disk.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/src/util/disk.c b/src/util/disk.c
index 31e8f12c6..e0227be70 100644
--- a/src/util/disk.c
+++ b/src/util/disk.c
@@ -830,6 +830,12 @@ GNUNET_DISK_directory_create_for_file (const char 
*filename)
     errno = EINVAL;
     return GNUNET_SYSERR;
   }
+  if (0 == ACCESS (rdir, W_OK))
+  {
+    GNUNET_free (rdir);
+    return GNUNET_OK;
+  }
+
   len = strlen (rdir);
   while ((len > 0) && (rdir[len] != DIR_SEPARATOR))
     len--;
@@ -1686,16 +1692,19 @@ GNUNET_DISK_file_open (const char *fn,
     return NULL;
   }
   if (flags & GNUNET_DISK_OPEN_FAILIFEXISTS)
-    oflags |= (O_CREAT | O_EXCL);
+      oflags |= (O_CREAT | O_EXCL);
   if (flags & GNUNET_DISK_OPEN_TRUNCATE)
     oflags |= O_TRUNC;
   if (flags & GNUNET_DISK_OPEN_APPEND)
     oflags |= O_APPEND;
-  if (flags & GNUNET_DISK_OPEN_CREATE)
-  {
-    (void) GNUNET_DISK_directory_create_for_file (expfn);
-    oflags |= O_CREAT;
-    mode = translate_unix_perms (perm);
+  if(GNUNET_NO == GNUNET_DISK_file_test(fn))
+   {
+      if (flags & GNUNET_DISK_OPEN_CREATE )
+       {
+         (void) GNUNET_DISK_directory_create_for_file (expfn);
+         oflags |= O_CREAT;
+         mode = translate_unix_perms (perm);
+       }
   }
 
   fd = open (expfn, oflags

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]