From eaa617bd80d69ff2c35e2c152bd9a2bfd0f21713 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 27 Feb 2025 15:55:48 +0600 Subject: [PATCH] Test fix for file creation under root --- source/libublsettings.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/libublsettings.c b/source/libublsettings.c index b08ab89..fe57668 100644 --- a/source/libublsettings.c +++ b/source/libublsettings.c @@ -2557,6 +2557,7 @@ int yon_file_save(char *file_path, char *text){ FILE *file = fopen(file_path,"w"); struct passwd *user = getpwnam(yon_ubl_root_user_get()); if (chown(file_path,user->pw_uid,user->pw_gid)){}; + if (chmod(file_path,0755)){}; if (file){ fputs(text,file); fclose(file); @@ -2573,6 +2574,7 @@ int yon_file_create(char *path, char *name, int rules){ if (fl){ struct passwd *user = getpwnam(yon_ubl_root_user_get()); if (chown(path,user->pw_uid,user->pw_gid)){}; + if (chmod(path,0755)){}; fclose(fl); return 1; } else { @@ -2608,6 +2610,7 @@ int yon_file_create_full_path(char *path, mode_t rules){ if (i>2){ struct passwd *user = getpwnam(yon_ubl_root_user_get()); int chown_success = chown(temp,user->pw_uid,user->pw_gid); + int chmod_success = chmod(temp,0755); } } if (!yon_char_is_empty(current)) free(current);