restic/internal/archiver
Alexander Neumann 2218ecd049 archiver: Use lstat before open/fstat
The previous code tried to be as efficient as possible and only do a
single open() on an item to save, and then fstat() on the fd to find out
what the item is (file, dir, other). For normal files, it would then
start reading the data without opening the file again, so it could not
be exchanged for e.g. a symlink.

This behavior starts the watchdog on my machine when /dev is saved
with restic, and after a few seconds, the machine reboots.

This commit reverts the behavior to the strategy the old archiver code
used: run lstat(), then decide what to do. For normal files, open the
file and then run fstat() on the fd to verify it's still a normal file,
then start reading the data.

The downside is that for normal files we now do two stat() calls
(lstat+fstat) instead of only one. On the upside, this does not start
the watchdog. :)
2018-05-01 23:05:50 +02:00
..
archiver.go archiver: Use lstat before open/fstat 2018-05-01 23:05:50 +02:00
archiver_test.go archiver: Process dirs concurrently 2018-04-30 15:13:28 +02:00
blob_saver.go archiver: Process dirs concurrently 2018-04-30 15:13:28 +02:00
buffer.go archiver: Improve buffer pool 2018-04-30 15:13:28 +02:00
file_saver.go archiver: Improve buffer pool 2018-04-30 15:13:28 +02:00
index_uploader.go Add new archiver code 2018-04-25 14:42:45 +02:00
scanner.go Add new archiver code 2018-04-25 14:42:45 +02:00
scanner_test.go Add new archiver code 2018-04-25 14:42:45 +02:00
testing.go Use new archiver code in tests 2018-04-25 14:42:45 +02:00
testing_test.go Use new archiver code in tests 2018-04-25 14:42:45 +02:00
tree.go Add new archiver code 2018-04-25 14:42:45 +02:00
tree_saver.go archiver: Process dirs concurrently 2018-04-30 15:13:28 +02:00
tree_test.go Add new archiver code 2018-04-25 14:42:45 +02:00