Page MenuHomeFreeBSD

rc.d/motd: Update motd more robustly
ClosedPublic

Authored by cem on Jun 19 2019, 8:06 PM.

Details

Summary

Use appropriate fsyncs to persist the rewritten /etc/motd file, when a
rewrite is performed.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

cem created this revision.Jun 19 2019, 8:06 PM
vangyzen accepted this revision.Jun 19 2019, 8:09 PM
This revision is now accepted and ready to land.Jun 19 2019, 8:09 PM
cem updated this revision to Diff 58805.Jun 19 2019, 8:21 PM

As mjg@ points out, the mktemp file may be on a different filesystem than /etc
(e.g., tmpfs, but any other filesystem invalidates the initial fsync). Copy to
a temporary /etc file, sync that, then rename over /etc/motd.

This revision now requires review to proceed.Jun 19 2019, 8:21 PM
allanjude accepted this revision.Jun 19 2019, 9:07 PM
This revision is now accepted and ready to land.Jun 19 2019, 9:07 PM
vangyzen accepted this revision.Jun 21 2019, 2:21 AM
This revision was automatically updated to reflect the committed changes.