commit d805a1ec9c6131ac3b361286ea0d759b1f427d5c
parent ff75ef69c18fc9211e2211f744744a381ede4ab7
Author: Andreas Gruhler <agruhl@gmx.ch>
Date: Mon, 31 May 2021 22:16:18 +0200
chmod after write
Diffstat:
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/caldav.c b/caldav.c
@@ -85,9 +85,6 @@ char* read_tokenfile() {
char* tokenfile_path = expand_path(CONFIG.google_tokenfile);
token_file = fopen(tokenfile_path, "r");
- chmod(tokenfile_path, S_IRUSR|S_IWUSR);
- perror("chmod");
-
if (token_file == NULL) {
perror("Failed to open tokenfile");
return NULL;
@@ -146,6 +143,10 @@ void write_tokenfile() {
fprintf(tokenfile, contents);
}
fclose(tokenfile);
+
+ chmod(tokenfile_path, S_IRUSR|S_IWUSR);
+ perror("chmod");
+
char* token_json = read_tokenfile();
fprintf(stderr, "New tokenfile contents: %s\n", token_json);
fprintf(stderr, "New Access token: %s\n", access_token);