depmod: prevent module dependency files corruption due to parallel invocation.

Depmod does not use unique filename for temporary files. There is no
guarantee the user does not attempt to run mutiple depmod processes in
parallel. If that happens a temporary file might be created by
depmod(1st), truncated by depmod(2nd), and renamed to final name by
depmod(1st) resulting in corrupted file seen by user.

Due to missing mkstempat() this is more complex than it should be.
Adding PID and timestamp to the filename should be reasonably reliable.
Adding O_EXCL as mkstemp does fails creating the file rather than
corrupting existing file.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
1 file changed
tree: 13b4e7f4a9577ad04960759dd7b96219f5ed05e8
  1. libkmod/
  2. m4/
  3. man/
  4. shared/
  5. shell-completion/
  6. testsuite/
  7. tools/
  8. .gitignore
  9. .travis.yml
  10. autogen.sh
  11. CODING-STYLE
  12. configure.ac
  13. COPYING
  14. Makefile.am
  15. NEWS
  16. README
  17. README.md
  18. TODO
README.md

kmod - Linux kernel module handling

Build Status
Coverity Scan Status

This is a mirror only. Please see README file for more information.