]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Document the buggy return codes of archive_write_data when writing to an archive_writ...
authorTim Kientzle <kientzle@acm.org>
Sat, 21 Jun 2014 04:39:50 +0000 (21:39 -0700)
committerTim Kientzle <kientzle@acm.org>
Sat, 21 Jun 2014 04:39:50 +0000 (21:39 -0700)
libarchive/archive_write_data.3
libarchive/archive_write_disk_posix.c
libarchive/archive_write_disk_windows.c

index cfd5cd552d050255c5bf39c920e6f2ddf3f739e0..a85f61d3a4d36a6b04d0e9144008a673189da4d9 100644 (file)
@@ -42,8 +42,7 @@ Write data corresponding to the header just written.
 .\"
 .Sh RETURN VALUES
 This function returns the number of bytes actually written, or
-.Li -1
-on error.
+a negative error code on error.
 .\"
 .Sh ERRORS
 Detailed error codes and textual descriptions are available from the
@@ -52,6 +51,15 @@ and
 .Fn archive_error_string
 functions.
 .\"
+.Sh BUGS
+In libarchive 3.x, this function sometimes returns
+zero on success instead of returning the number of bytes written.
+Specifically, this occurs when writing to an
+.Vt archive_write_disk
+handle.
+Clients should treat any value less than zero as an error
+and consider any non-negative value as success.
+.\"
 .Sh SEE ALSO
 .Xr tar 1 ,
 .Xr libarchive 3 ,
index 1fac4cecfe8ea70e50be835921f85993af75dd78..ee16d9d76efbff6726d04ff28ea46c9e2b6c6f75 100644 (file)
@@ -1470,7 +1470,11 @@ _archive_write_disk_data_block(struct archive *_a,
                    "Write request too large");
                return (ARCHIVE_WARN);
        }
+#if ARCHIVE_VERSION_NUMBER < 3999000
        return (ARCHIVE_OK);
+#else
+       return (size);
+#endif
 }
 
 static ssize_t
index 512caf439590290ae2642589a25a76366304c50a..800aa893f420a50570525defc19d8372ae7e820f 100644 (file)
@@ -1009,7 +1009,11 @@ _archive_write_disk_data_block(struct archive *_a,
                    "Write request too large");
                return (ARCHIVE_WARN);
        }
+#if ARCHIVE_VERSION_NUMBER < 3999000
        return (ARCHIVE_OK);
+#else
+       return (size);
+#endif
 }
 
 static ssize_t