Skip to content

Commit

Permalink
utilities: Prevent deadlock in rm_util_is_nonstripped
Browse files Browse the repository at this point in the history
Only attempt to open regular files. It is entirely possible that we
encounter an executable FIFO, which causes open() to block indefinitely
if it is not opened for writing by another process.

Fixes sahib#555
  • Loading branch information
cebtenzzre authored and intelfx committed Mar 9, 2023
1 parent ba76235 commit 718a7e7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/utilities.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ bool rm_util_is_nonstripped(_UNUSED const char *path, _UNUSED RmStat *statp) {
#if HAVE_LIBELF
g_return_val_if_fail(path, false);

if(statp && (statp->st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) == 0) {
if(!S_ISREG(statp->st_mode) || (statp->st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) == 0) {
return false;
}

Expand Down

0 comments on commit 718a7e7

Please sign in to comment.