Put warning about possibly wrong password at appropriate place in stream.c

Use char to be consistent in open_stream_in.
Fail to failure() instead of fatal() should open_stream_in fail.
This commit is contained in:
Con Kolivas 2011-03-23 01:13:15 +11:00
parent 64bba65c11
commit f7a1c14e28
2 changed files with 5 additions and 3 deletions

View file

@ -303,7 +303,7 @@ static i64 runzip_chunk(rzip_control *control, int fd_in, int fd_out, int fd_his
ss = open_stream_in(control, fd_in, NUM_STREAMS, chunk_bytes);
if (unlikely(!ss))
fatal("Failed to open_stream_in in runzip_chunk\n");
failure("Failed to open_stream_in in runzip_chunk\n");
while ((len = read_header(control, ss, &head)) || head) {
switch (head) {

View file

@ -584,7 +584,7 @@ static int lzma_decompress_buf(rzip_control *control, struct uncomp_thread *ucth
c_buf = ucthread->s_buf;
ucthread->s_buf = malloc(dlen);
if (unlikely(!ucthread->s_buf)) {
print_err("Failed to allocate %lldd bytes for decompression\n", (i64)dlen);
print_err("Failed to allocate %lld bytes for decompression\n", (i64)dlen);
ret = -1;
goto out;
}
@ -1072,7 +1072,7 @@ static void decrypt_header(rzip_control *control, uchar *head, uchar *c_type,
}
/* prepare a set of n streams for reading on file descriptor f */
void *open_stream_in(rzip_control *control, int f, int n, int chunk_bytes)
void *open_stream_in(rzip_control *control, int f, int n, char chunk_bytes)
{
struct stream_info *sinfo;
int total_threads, i;
@ -1190,6 +1190,8 @@ again:
if (unlikely(c != CTYPE_NONE)) {
print_err("Unexpected initial tag %d in streams\n", c);
if (ENCRYPT)
print_err("Wrong password?\n");
goto failed;
}
if (unlikely(v1)) {