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. --- gtp/gtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
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 @@ static void log_restart(struct gsn_t *gsn) goto free_filename; }
- umask(i); fprintf(f, "%d\n", gsn->restart_counter); close_file: if (fclose(f)) @@ -689,6 +688,7 @@ close_file: "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,