mirror of
https://github.com/ckolivas/lrzip.git
synced 2025-12-06 07:12:00 +01:00
We are flushing the wrong file on decompression. Make sure we flush the file out.
This commit is contained in:
parent
6b73eb1394
commit
9c2b86fec6
2
main.c
2
main.c
|
|
@ -292,6 +292,7 @@ static void decompress_file(void)
|
||||||
preserve_perms(fd_in, fd_out);
|
preserve_perms(fd_in, fd_out);
|
||||||
} else
|
} else
|
||||||
fd_out = open_tmpoutfile();
|
fd_out = open_tmpoutfile();
|
||||||
|
control.fd_out = fd_out;
|
||||||
|
|
||||||
fd_hist = open(control.outfile, O_RDONLY);
|
fd_hist = open(control.outfile, O_RDONLY);
|
||||||
if (unlikely(fd_hist == -1))
|
if (unlikely(fd_hist == -1))
|
||||||
|
|
@ -490,6 +491,7 @@ static void compress_file(void)
|
||||||
fatal("Failed to create %s: %s\n", control.outfile, strerror(errno));
|
fatal("Failed to create %s: %s\n", control.outfile, strerror(errno));
|
||||||
} else
|
} else
|
||||||
fd_out = open_tmpoutfile();
|
fd_out = open_tmpoutfile();
|
||||||
|
control.fd_out = fd_out;
|
||||||
|
|
||||||
preserve_perms(fd_in, fd_out);
|
preserve_perms(fd_in, fd_out);
|
||||||
|
|
||||||
|
|
|
||||||
1
rzip.h
1
rzip.h
|
|
@ -266,6 +266,7 @@ struct rzip_control {
|
||||||
int minor_version;
|
int minor_version;
|
||||||
i64 st_size;
|
i64 st_size;
|
||||||
long page_size;
|
long page_size;
|
||||||
|
int fd_out;
|
||||||
} control;
|
} control;
|
||||||
|
|
||||||
struct stream {
|
struct stream {
|
||||||
|
|
|
||||||
6
stream.c
6
stream.c
|
|
@ -43,7 +43,6 @@ struct uncomp_thread{
|
||||||
sem_t ready; /* Taken this thread's data so it can die */
|
sem_t ready; /* Taken this thread's data so it can die */
|
||||||
sem_t free;
|
sem_t free;
|
||||||
int stream;
|
int stream;
|
||||||
int fd;
|
|
||||||
} *ucthread;
|
} *ucthread;
|
||||||
|
|
||||||
void init_sem(sem_t *sem)
|
void init_sem(sem_t *sem)
|
||||||
|
|
@ -969,7 +968,7 @@ static void *compthread(void *t)
|
||||||
cti->c_type = CTYPE_NONE;
|
cti->c_type = CTYPE_NONE;
|
||||||
cti->c_len = cti->s_len;
|
cti->c_len = cti->s_len;
|
||||||
|
|
||||||
/* Flushing writes to disk, frees up any dirty ram, improving chances
|
/* Flushing writes to disk frees up any dirty ram, improving chances
|
||||||
* of succeeding in allocating more ram */
|
* of succeeding in allocating more ram */
|
||||||
fsync(ctis->fd);
|
fsync(ctis->fd);
|
||||||
retry:
|
retry:
|
||||||
|
|
@ -1095,7 +1094,6 @@ static void *ucompthread(void *t)
|
||||||
if (unlikely(setpriority(PRIO_PROCESS, 0, control.nice_val) == -1))
|
if (unlikely(setpriority(PRIO_PROCESS, 0, control.nice_val) == -1))
|
||||||
print_err("Warning, unable to set nice value on thread\n");
|
print_err("Warning, unable to set nice value on thread\n");
|
||||||
|
|
||||||
fsync(uci->fd);
|
|
||||||
retry:
|
retry:
|
||||||
if (uci->c_type != CTYPE_NONE) {
|
if (uci->c_type != CTYPE_NONE) {
|
||||||
switch (uci->c_type) {
|
switch (uci->c_type) {
|
||||||
|
|
@ -1190,6 +1188,7 @@ fill_another:
|
||||||
|
|
||||||
/* Wait till the next thread is free */
|
/* Wait till the next thread is free */
|
||||||
wait_sem(&ucthread[s->uthread_no].free);
|
wait_sem(&ucthread[s->uthread_no].free);
|
||||||
|
fsync(control.fd_out);
|
||||||
|
|
||||||
s_buf = malloc(u_len);
|
s_buf = malloc(u_len);
|
||||||
if (unlikely(u_len && !s_buf))
|
if (unlikely(u_len && !s_buf))
|
||||||
|
|
@ -1205,7 +1204,6 @@ fill_another:
|
||||||
ucthread[s->uthread_no].u_len = u_len;
|
ucthread[s->uthread_no].u_len = u_len;
|
||||||
ucthread[s->uthread_no].c_type = c_type;
|
ucthread[s->uthread_no].c_type = c_type;
|
||||||
ucthread[s->uthread_no].stream = stream;
|
ucthread[s->uthread_no].stream = stream;
|
||||||
ucthread[s->uthread_no].fd = sinfo->fd;
|
|
||||||
s->last_head = last_head;
|
s->last_head = last_head;
|
||||||
|
|
||||||
print_maxverbose("Starting thread %ld to decompress %lld bytes from stream %d\n",
|
print_maxverbose("Starting thread %ld to decompress %lld bytes from stream %d\n",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue