Skip to content

Commit 4838a97

Browse files
committed
Ignore check for existing files when creating non-empty files
When creating files the check for existence is skipped if any data is specified to write to the file. This ensures that new file contents are always written. This fixes a bug where, for example, the application-profiles file was not updated correctly for multiple GPUs. Signed-off-by: Evan Lezar <[email protected]>
1 parent ad68344 commit 4838a97

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/utils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ file_create(struct error *err, const char *path, const char *data, uid_t uid, gi
524524
int rv = -1;
525525

526526
// We check whether the file already exists with the required mode and skip the creation.
527-
if (file_mode(err, path, &perm) == 0) {
527+
if (data == NULL && file_mode(err, path, &perm) == 0) {
528528
if (perm == mode) {
529529
log_errf("The path %s alreay exists with the required mode; skipping create", path);
530530
return (0);

0 commit comments

Comments
 (0)