X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Fwrite.c;h=7f13630cceec991aea303afd27b74f0b1b67f888;hp=f3308a24c14f88ffa47b579680c2e484a040b936;hb=05bbdd83d65782a9872b579505e1299587cd2009;hpb=ab64cfca6f15354ccef5a86441cd9c35898a220a diff --git a/src/write.c b/src/write.c index f3308a24..7f13630c 100644 --- a/src/write.c +++ b/src/write.c @@ -2430,7 +2430,10 @@ finish_write(WIMStruct *wim, int image, int write_flags, ret = WIMLIB_ERR_WRITE; if (unlikely(write_flags & WIMLIB_WRITE_FLAG_UNSAFE_COMPACT)) { /* Truncate any data the compaction freed up. */ - if (ftruncate(wim->out_fd.fd, wim->out_fd.offset)) { + if (ftruncate(wim->out_fd.fd, wim->out_fd.offset) && + errno != EINVAL) /* allow compaction on untruncatable files, + e.g. block devices */ + { ERROR_WITH_ERRNO("Failed to truncate the output WIM file"); goto out; }