Skip to content

Commit

Permalink
Use more common errno values to improve portability.
Browse files Browse the repository at this point in the history
  • Loading branch information
madler committed May 30, 2016
1 parent b327e28 commit 7f050dd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pigz.c
Expand Up @@ -833,7 +833,7 @@ local void cut_short(int sig)
g.outd = -1;
}
log_dump();
_exit(sig < 0 ? -sig : ECANCELED);
_exit(sig < 0 ? -sig : EINTR);
}

/* common code for catch block of top routine in the thread */
Expand Down Expand Up @@ -875,7 +875,7 @@ local inline size_t vmemcpy(char **mem, size_t *size, size_t off,

need = off + len;
if (need < off)
throw(EOVERFLOW, "overflow");
throw(ERANGE, "overflow");
if (need > *size) {
need = grow(need);
if (off == 0) {
Expand Down Expand Up @@ -1297,7 +1297,7 @@ local void grow_space(struct space *space)
/* compute next size up */
more = grow(space->size);
if (more == space->size)
throw(EOVERFLOW, "overflow");
throw(ERANGE, "overflow");

/* reallocate the buffer */
space->buf = alloc(space->buf, more);
Expand Down Expand Up @@ -1987,7 +1987,7 @@ local void parallel_compress(void)
job->seq = seq;
Trace(("-- read #%ld%s", seq, more ? "" : " (last)"));
if (++seq < 1)
throw(EOVERFLOW, "overflow");
throw(ERANGE, "overflow");

/* start another compress thread if needed */
if (cthreads < seq && cthreads < g.procs) {
Expand Down Expand Up @@ -3476,7 +3476,7 @@ local void process(char *path)
errno = 0;
} while (lstat(g.inf, &st) && errno == ENOENT);
}
#ifdef EOVERFLOW
#if defined(EOVERFLOW) && defined(EFBIG)
if (errno == EOVERFLOW || errno == EFBIG)
throw(EDOM, "%s too large -- "
"not compiled with large file support", g.inf);
Expand Down

0 comments on commit 7f050dd

Please sign in to comment.