mirror of
https://github.com/opnsense/src.git
synced 2026-02-20 00:11:07 -05:00
Fix race when testing for ETXTBSY writing to ${n0} (process image) by making
sure the process has been started beforehand with pgrep pkill the process afterwards to make sure it's dead when the unlink is run (not strictly required, but I was being conservative) MFC after: 1 week Reviewed by: Darius O'Conner, mjohnston Sponsored by: EMC / Isilon Storage Division
This commit is contained in:
parent
546afaf83d
commit
f95c930e67
2 changed files with 8 additions and 0 deletions
|
|
@ -14,7 +14,11 @@ n0=`namegen`
|
|||
|
||||
cp -pf `which sleep` ${n0}
|
||||
./${n0} 3 &
|
||||
while ! pkill -0 -f ./${n0}; do
|
||||
sleep 0.1
|
||||
done
|
||||
expect ETXTBSY open ${n0} O_WRONLY
|
||||
expect ETXTBSY open ${n0} O_RDWR
|
||||
expect ETXTBSY open ${n0} O_RDONLY,O_TRUNC
|
||||
pkill -9 -f ./${n0}
|
||||
expect 0 unlink ${n0}
|
||||
|
|
|
|||
|
|
@ -14,5 +14,9 @@ n0=`namegen`
|
|||
|
||||
cp -pf `which sleep` ${n0}
|
||||
./${n0} 3 &
|
||||
while ! pkill -0 -f ./${n0}; do
|
||||
sleep 0.1
|
||||
done
|
||||
expect ETXTBSY truncate ${n0} 123
|
||||
pkill -9 -f ./${n0}
|
||||
expect 0 unlink ${n0}
|
||||
|
|
|
|||
Loading…
Reference in a new issue