[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] branch master updated: do not use atomic write for configuratio
From: |
gnunet |
Subject: |
[gnunet] branch master updated: do not use atomic write for configuration file, we may not have permissions to do this, also should not be necessary |
Date: |
Thu, 31 Dec 2020 09:13:28 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new ebd853c83 do not use atomic write for configuration file, we may not
have permissions to do this, also should not be necessary
new 4eca30652 Merge branch 'master' of git+ssh://gnunet.org/gnunet
ebd853c83 is described below
commit ebd853c83ce0f03fa59d1672b86190406659d901
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Thu Dec 31 09:12:43 2020 +0100
do not use atomic write for configuration file, we may not have permissions
to do this, also should not be necessary
---
debian/gnunet.postrm | 14 +++++++++-----
src/util/configuration.c | 48 ++++++++++++++++++++++++++++++++----------------
2 files changed, 41 insertions(+), 21 deletions(-)
diff --git a/debian/gnunet.postrm b/debian/gnunet.postrm
index 0aba484db..2c3887202 100644
--- a/debian/gnunet.postrm
+++ b/debian/gnunet.postrm
@@ -33,10 +33,6 @@ remove_gns() {
}
s/^(hosts:)(.*)/$1.remove($2)/e;
' /etc/nsswitch.conf
- # remove the gns nsswitch plugins as well
- rm -rf /usr/lib/x86_64-linux-gnu/usr/libnss_gns.so.2
- rm -rf /usr/lib/x86_64-linux-gnu/usr/libnss_gns4.so.2
- rm -rf /usr/lib/x86_64-linux-gnu/usr/libnss_gns6.so.2
}
@@ -81,11 +77,19 @@ case "${1}" in
delgroup --quiet --system --only-if-empty
${GNUNETDNS_GROUP} || true
fi
- rm -rf /var/log/gnunetd /var/lib/gnunet /etc/default/gnunet
+ rm -rf /var/log/gnunet.log /var/lib/gnunet /etc/default/gnunet
;;
remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+ if $_LIBNSSWITCH
+ then
+ rm -rf /usr/lib/x86_64-linux-gnu/usr/libnss_gns.so.2
+ rm -rf /usr/lib/x86_64-linux-gnu/usr/libnss_gns4.so.2
+ rm -rf /usr/lib/x86_64-linux-gnu/usr/libnss_gns6.so.2
+ remove_gns
+ fi
+
;;
*)
diff --git a/src/util/configuration.c b/src/util/configuration.c
index ecdcb3d53..23e6ced98 100644
--- a/src/util/configuration.c
+++ b/src/util/configuration.c
@@ -543,23 +543,39 @@ GNUNET_CONFIGURATION_write (struct
GNUNET_CONFIGURATION_Handle *cfg,
}
cfg_buf = GNUNET_CONFIGURATION_serialize (cfg,
&size);
- (void) GNUNET_DISK_directory_remove (fn);
- if (GNUNET_OK !=
- GNUNET_DISK_fn_write (fn,
- cfg_buf,
- size,
- GNUNET_DISK_PERM_USER_READ
- | GNUNET_DISK_PERM_USER_WRITE
- | GNUNET_DISK_PERM_GROUP_READ
- | GNUNET_DISK_PERM_GROUP_WRITE))
{
- GNUNET_free (fn);
- GNUNET_free (cfg_buf);
- LOG (GNUNET_ERROR_TYPE_WARNING,
- "Writing configuration to file `%s' failed\n",
- filename);
- cfg->dirty = GNUNET_SYSERR; /* last write failed */
- return GNUNET_SYSERR;
+ struct GNUNET_DISK_FileHandle *h;
+
+ h = GNUNET_DISK_file_open (fn,
+ GNUNET_DISK_OPEN_WRITE
+ | GNUNET_DISK_OPEN_TRUNCATE
+ | GNUNET_DISK_OPEN_CREATE,
+ GNUNET_DISK_PERM_USER_READ
+ | GNUNET_DISK_PERM_USER_WRITE
+ | GNUNET_DISK_PERM_GROUP_READ
+ | GNUNET_DISK_PERM_GROUP_WRITE);
+ if (NULL == h)
+ {
+ GNUNET_free (fn);
+ return GNUNET_SYSERR;
+ }
+ if (((ssize_t) size) !=
+ GNUNET_DISK_file_write (h,
+ cfg_buf,
+ size))
+ {
+ GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
+ "write",
+ fn);
+ GNUNET_DISK_file_close (h);
+ (void) GNUNET_DISK_directory_remove (fn);
+ GNUNET_free (fn);
+ GNUNET_free (cfg_buf);
+ cfg->dirty = GNUNET_SYSERR; /* last write failed */
+ return GNUNET_SYSERR;
+ }
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_DISK_file_close (h));
}
GNUNET_free (fn);
GNUNET_free (cfg_buf);
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet] branch master updated: do not use atomic write for configuration file, we may not have permissions to do this, also should not be necessary,
gnunet <=