2
2
mirror of https://github.com/octoleo/restic.git synced 2024-09-28 06:29:01 +00:00
restic/internal
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 archiver: Use lstat before open/fstat 2018-05-01 23:05:50 +02:00
backend http backend: Parse the correct argument when loading --tls-client-cert 2018-04-30 15:21:09 -07:00
cache Add 'cache' command 2018-05-01 16:27:44 +02:00
checker Use new archiver code in tests 2018-04-25 14:42:45 +02:00
crypto crypto: Rework Seal/Open to use sliceForAppend 2017-11-01 10:30:40 +01:00
debug debug: Auto-shorten IDs passed as parameters 2018-01-25 20:49:26 +01:00
errors errors: Make Cause() unwrap *url.Error 2018-01-23 23:14:05 +01:00
filter filter: document recursive wildcards 2017-09-04 14:38:48 -07:00
fs fs: Add TestTempFile 2018-05-01 14:38:41 +02:00
fuse Add support for illumos/Solaris 2018-03-04 20:11:29 +00:00
hashing Moves files 2017-07-23 14:19:13 +02:00
index Merge pull request #1582 from restic/optimize-debug-log 2018-01-26 21:57:18 +01:00
limiter backend: Improve Save() 2018-03-03 15:49:44 +01:00
list Optimize Repository.ListPack() 2018-01-23 22:39:51 -05:00
migrations Fix calls to repo/backend.List() everywhere 2018-01-21 21:15:09 +01:00
mock check: Allow filling the cache during check 2018-04-01 13:59:27 +02:00
options errors: Add "Fatal" prefix for Fatalf() 2018-01-06 23:27:47 +01:00
pack backend: Improve Save() 2018-03-03 15:49:44 +01:00
repository repository: Improve buffer pooling 2018-04-22 11:37:05 +02:00
restic backup: Clean target paths before finding parent 2018-04-30 22:03:11 +02:00
test Add test.Helper, also works with Go 1.8 2018-04-22 11:37:05 +02:00
textfile Add textfile 2018-05-01 14:38:59 +02:00
ui backup: Clear status lines on finish 2018-04-30 14:19:07 +02:00
worker Run goimports 2017-07-23 14:21:03 +02:00