• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From 1a6a9d6878ed00265941939adc468a517cd5ef36 Mon Sep 17 00:00:00 2001
2From: Nick Wellnhofer <wellnhofer@aevum.de>
3Date: Tue, 14 Mar 2023 14:19:03 +0100
4Subject: [PATCH] xzlib: Fix implicit sign change in xz_open
5
6
7Reference:https://github.com/GNOME/libxml2/commit/1a6a9d6878ed00265941939adc468a517cd5ef36
8Conflict:NA
9
10---
11 xzlib.c | 7 +++++--
12 1 file changed, 5 insertions(+), 2 deletions(-)
13
14diff --git a/xzlib.c b/xzlib.c
15index 9a34738..8d75590 100644
16--- a/xzlib.c
17+++ b/xzlib.c
18@@ -139,6 +139,7 @@ static xzFile
19 xz_open(const char *path, int fd, const char *mode ATTRIBUTE_UNUSED)
20 {
21     xz_statep state;
22+    off_t offset;
23
24     /* allocate xzFile structure to return */
25     state = xmlMalloc(sizeof(xz_state));
26@@ -173,9 +174,11 @@ xz_open(const char *path, int fd, const char *mode ATTRIBUTE_UNUSED)
27     }
28
29     /* save the current position for rewinding (only if reading) */
30-    state->start = lseek(state->fd, 0, SEEK_CUR);
31-    if (state->start == (uint64_t) - 1)
32+    offset = lseek(state->fd, 0, SEEK_CUR);
33+    if (offset == -1)
34         state->start = 0;
35+    else
36+        state->start = offset;
37
38     /* initialize stream */
39     xz_reset(state);
40--
412.27.0
42
43