Skip to content

Commit

Permalink
Do not attempt chmod on windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
userwiths committed Aug 30, 2024
1 parent e8ba5b2 commit 35e0ffd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libfreshclam/libfreshclam.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,15 @@ int fc_upsert_logg_file(fc_config *fcConfig)
ret = -1;
goto cleanup;
}
#ifndef _WIN32
if (current_user->pw_uid != db_owner->pw_uid) {
if (lchown(current_path, db_owner->pw_uid, db_owner->pw_gid) == -1) {
printf("ERROR: Failed to change owner of %s to %s. Will continue without writing in %s.\n", current_path, fcConfig->dbOwner, fcConfig->logFile);
ret = -1;
goto cleanup;
}
}
#endif /* _WIN32 */
}
strcat(current_path, PATHSEP);
}
Expand All @@ -165,7 +167,9 @@ int fc_upsert_logg_file(fc_config *fcConfig)
ret = -1;
goto cleanup;
}
#ifndef _WIN32
lchown(fcConfig->logFile, db_owner->pw_uid, db_owner->pw_gid);
#endif /* _WIN32 */

cleanup:
if (token != NULL) {
Expand Down

0 comments on commit 35e0ffd

Please sign in to comment.