Skip to content

Commit

Permalink
Merge pull request #188 from dannf/proc-read-race
Browse files Browse the repository at this point in the history
initramfs: Avoid noise due to /proc race
  • Loading branch information
sergio-correia authored Apr 29, 2020
2 parents ecb5441 + e2fd826 commit e9fb467
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/initramfs-tools/scripts/local-top/clevis.in
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,9 @@ clevisloop() {
done

# Import CRYPTTAB_SOURCE from the askpass process.
local "$(tr '\0' '\n' < /proc/${pid}/environ | \
grep '^CRYPTTAB_SOURCE=')"
local CRYPTTAB_SOURCE="$(cat /proc/${pid}/environ 2> /dev/null | \
tr '\0' '\n' | grep '^CRYPTTAB_SOURCE=' | cut -d= -f2)"
[ -n "$CRYPTTAB_SOURCE" ] || continue

# Make sure that CRYPTTAB_SOURCE is actually a block device
[ ! -b "$CRYPTTAB_SOURCE" ] && continue
Expand Down

0 comments on commit e9fb467

Please sign in to comment.