From 9f6631bfbe0d71336300edb683433fc32c8f28ae Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Sun, 15 Oct 2017 14:53:44 -0700 Subject: [PATCH 1/2] Expose torrent_alert::torrent_name in python bindings (#2449) --- bindings/python/src/alert.cpp | 1 + bindings/python/test.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/bindings/python/src/alert.cpp b/bindings/python/src/alert.cpp index c53c6b8bd..8a0dd0aa6 100644 --- a/bindings/python/src/alert.cpp +++ b/bindings/python/src/alert.cpp @@ -235,6 +235,7 @@ void bind_alert() class_, noncopyable>( "torrent_alert", no_init) .add_property("handle", make_getter(&torrent_alert::handle, by_value())) + .add_property("torrent_name", &torrent_alert::torrent_name) ; class_, noncopyable>( diff --git a/bindings/python/test.py b/bindings/python/test.py index 7afeaa830..13348db0d 100644 --- a/bindings/python/test.py +++ b/bindings/python/test.py @@ -231,6 +231,8 @@ class test_alerts(unittest.TestCase): ses.wait_for_alert(1000) # milliseconds alerts = ses.pop_alerts() for a in alerts: + if a.what() == 'add_torrent_alert': + self.assertEquals(a.torrent_name, 'temp') print(a.message()) for field_name in dir(a): if field_name.startswith('__'): continue From 205fe5e7ea72afb089f38232876e932cc3ee5fac Mon Sep 17 00:00:00 2001 From: arvidn Date: Sun, 15 Oct 2017 15:19:25 +0200 Subject: [PATCH 2/2] fix full allocation failure on APFS --- ChangeLog | 2 ++ src/file.cpp | 26 ++++++++++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3f4e5d323..1e3af50e9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,6 @@ + * fix full allocation failure on APFS + 1.1.5 release * fix infinite loop when parsing certain invalid magnet links diff --git a/src/file.cpp b/src/file.cpp index f0affe05a..1374be743 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -2115,17 +2115,23 @@ typedef struct _FILE_ALLOCATED_RANGE_BUFFER { fstore_t f = {F_ALLOCATECONTIG, F_PEOFPOSMODE, 0, s, 0}; if (fcntl(native_handle(), F_PREALLOCATE, &f) < 0) { - if (errno != ENOSPC) + // It appears Apple's new filesystem (APFS) does not + // support this control message and fails with EINVAL + // if so, just skip it + if (errno != EINVAL) { - ec.assign(errno, system_category()); - return false; - } - // ok, let's try to allocate non contiguous space then - f.fst_flags = F_ALLOCATEALL; - if (fcntl(native_handle(), F_PREALLOCATE, &f) < 0) - { - ec.assign(errno, system_category()); - return false; + if (errno != ENOSPC) + { + ec.assign(errno, system_category()); + return false; + } + // ok, let's try to allocate non contiguous space then + f.fst_flags = F_ALLOCATEALL; + if (fcntl(native_handle(), F_PREALLOCATE, &f) < 0) + { + ec.assign(errno, system_category()); + return false; + } } } #endif // F_PREALLOCATE