Page MenuHomeFreeBSD

locate.updatedb: Explicitly exit from trap code.
ClosedPublic

Authored by des on Aug 29 2024, 1:23 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Jan 24, 6:00 PM
Unknown Object (File)
Fri, Jan 24, 6:00 PM
Unknown Object (File)
Thu, Jan 23, 6:39 PM
Unknown Object (File)
Thu, Jan 23, 6:34 PM
Unknown Object (File)
Sat, Jan 18, 9:26 PM
Unknown Object (File)
Sat, Jan 18, 7:07 AM
Unknown Object (File)
Thu, Jan 9, 5:50 AM
Unknown Object (File)
Nov 24 2024, 11:12 AM
Subscribers

Details

Summary

When a signal is trapped, the script continues after the trap code has
run, unless the trap code explicitly exits. In the particular case of
locate.updatedb, this is mostly harmless, except that the trap code is
executed twice (once for the signal and once when we reach the end of
the script).

Furthermore, install the trap as soon as we've created the temporary
directory, to minimize the window during which we can fail to clean up
after ourselves if interrupted.

While here, simplify the empty check at the end and make some minor
style tweaks.

MFC after: 1 week
Sponsored by: Klara, Inc.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

des requested review of this revision.Aug 29 2024, 1:23 PM
des edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Aug 29 2024, 2:37 PM
This revision was automatically updated to reflect the committed changes.