[PATCH] openggsn[master]: gsn_restart file: set umask back to original after write fai...

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Thu Oct 6 17:31:01 UTC 2016


Review at  https://gerrit.osmocom.org/1014

gsn_restart file: set umask back to original after write failure

An fopen("w") error used to omit the umask() call to reinstate the previous
umask. Move the final umask() call to the bottom so that it is called in all
code paths.

Change-Id: If7d948e2f2ba47ecebba5614f18235a53b273d14
---
M gtp/gtp.c
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/openggsn refs/changes/14/1014/1

diff --git a/gtp/gtp.c b/gtp/gtp.c
index 161a6f0..a46a76f 100644
--- a/gtp/gtp.c
+++ b/gtp/gtp.c
@@ -681,7 +681,6 @@
 		goto free_filename;
 	}
 
-	umask(i);
 	fprintf(f, "%d\n", gsn->restart_counter);
 close_file:
 	if (fclose(f))
@@ -689,6 +688,7 @@
 			"fclose failed: Error = %s\n", strerror(errno));
 free_filename:
 	talloc_free(filename);
+	umask(i);
 }
 
 int gtp_new(struct gsn_t **gsn, char *statedir, struct in_addr *listen,

-- 
To view, visit https://gerrit.osmocom.org/1014
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If7d948e2f2ba47ecebba5614f18235a53b273d14
Gerrit-PatchSet: 1
Gerrit-Project: openggsn
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list