mirror of
https://github.com/borgbackup/borg.git
synced 2026-06-11 01:41:57 -04:00
macOS: fix TypeError when _get_birthtime_ns gets called with an FD
Crashed when trying to os.fsdecode(path) when path is an int.
This commit is contained in:
parent
ca3e88f5b1
commit
2bb9e4889b
1 changed files with 4 additions and 2 deletions
|
|
@ -190,13 +190,15 @@ def _get_birthtime_ns(path, follow_symlinks=False):
|
|||
cdef int result
|
||||
if isinstance(path, int):
|
||||
result = c_fstat(path, &stat_info)
|
||||
if result != 0:
|
||||
raise OSError(errno.errno, os.strerror(errno.errno), "<FD %d>" % path)
|
||||
else:
|
||||
if follow_symlinks:
|
||||
result = c_stat(path, &stat_info)
|
||||
else:
|
||||
result = c_lstat(path, &stat_info)
|
||||
if result != 0:
|
||||
raise OSError(errno.errno, os.strerror(errno.errno), os.fsdecode(path))
|
||||
if result != 0:
|
||||
raise OSError(errno.errno, os.strerror(errno.errno), os.fsdecode(path))
|
||||
return stat_info.st_birthtimespec.tv_sec * 1_000_000_000 + stat_info.st_birthtimespec.tv_nsec
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue