Skip to content

Commit 8c968ee

Browse files
committed
Fix parsing error for 0-instruction patch files.
Exit 0 on success for delta_command(). Used to exit 0 or 1 like diff.
1 parent 9902892 commit 8c968ee

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

xdelta1/libedsio/edsio.el

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,7 @@ replacement is as for replace-regexp."
10171017
(format "%s{
10181018
%s gint i;
10191019
%s if (! (* source->next_uint) (source, &%s_len)) goto bail;
1020-
%s if (! (%s = serializeio_source_alloc (source, sizeof (%s) * %s_len))) goto bail;
1020+
%s if ((%s_len > 0) && ! (%s = serializeio_source_alloc (source, sizeof (%s) * %s_len))) goto bail;
10211021
%s for (i = 0; i < %s_len; i += 1)
10221022
%s {
10231023
%s%s }
@@ -1028,6 +1028,7 @@ replacement is as for replace-regexp."
10281028
name
10291029
prefix
10301030
name
1031+
name
10311032
(field-ctype (cadr field))
10321033
name
10331034
prefix

xdelta1/xdmain.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#ifndef WINHACK
4040
#include <unistd.h>
4141
#include <sys/mman.h>
42-
#define O_BINARY 0
42+
// #define O_BINARY 0
4343

4444
#else /* WINHACK */
4545

@@ -260,6 +260,7 @@ help ()
260260
xd_error (" -h, --help Print this summary\n");
261261
xd_error (" -n, --noverify Disable automatic MD5 verification\n");
262262
xd_error (" -p, --pristine Disable automatic GZIP decompression\n");
263+
xd_error (" -q, --quiet Do not print warnings\n");
263264
xd_error (" -m, --maxmem=SIZE Set the buffer size limit, e.g. 640K, 16M\n");
264265
xd_error (" -[0-9] ZLIB compress level: 0=none, 1=fast, 6=default, 9=best\n");
265266
xd_error (" -s=BLOCK_SIZE Sets block size (power of 2), minimum match length\n");
@@ -1527,7 +1528,6 @@ delta_command (gint argc, gchar** argv)
15271528
xd_error ("using block size: %d bytes\n", xdp_blocksize ());
15281529
}
15291530

1530-
15311531
if (! (from = open_read_seek_handle (argv[0], &from_is_compressed, TRUE)))
15321532
return 2;
15331533

@@ -1647,7 +1647,10 @@ delta_command (gint argc, gchar** argv)
16471647

16481648
xdp_generator_free (gen);
16491649

1650-
return control_offset != header_offset;
1650+
/* Note: prior to 1.1.5:
1651+
* return control_offset != header_offset;
1652+
*/
1653+
return 0;
16511654
}
16521655

16531656
static XdeltaPatch*

0 commit comments

Comments
 (0)