diff options
author | Ito Hiroyuki <ZXB01226@nifty.com> | 2010-07-19 11:45:23 +0000 |
---|---|---|
committer | Ito Hiroyuki <ZXB01226@nifty.com> | 2010-07-19 11:45:23 +0000 |
commit | a19f155b48b2766343b410c767696c00ab9315d0 (patch) | |
tree | d33c5153033bf4cc46047b3ab9966ddc655b2cb5 /file.c | |
parent | * [w3m-dev 04238] [patch] simple preserve space (diff) | |
download | w3m-a19f155b48b2766343b410c767696c00ab9315d0.tar.gz w3m-a19f155b48b2766343b410c767696c00ab9315d0.zip |
* [w3m-dev 04321] Re: w3m's bugs from bugs.debian.org
* http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=185006#22
* main.c
(sig_chld): save exit code to d->err.
(addDownloadList): initialize d->running and d->err.
(DownloadListBuffer): check d->err.
* fm.h
(_DownloadList): add running and err.
* file.c
(save2tmp): check returned value of Strfputs().
(doFileSave): exit code is depend on the returned value of save2tmp().
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -1,4 +1,4 @@ -/* $Id: file.c,v 1.256 2010/07/19 09:00:34 htrb Exp $ */ +/* $Id: file.c,v 1.257 2010/07/19 11:45:24 htrb Exp $ */ #include "fm.h" #include <sys/types.h> #include "myctype.h" @@ -7761,7 +7761,13 @@ save2tmp(URLFile uf, char *tmpf) { Str buf = Strnew_size(SAVE_BUF_SIZE); while (UFread(&uf, buf, SAVE_BUF_SIZE)) { - Strfputs(buf, ff); + if (Strfputs(buf, ff) != buf->length) { + bcopy(env_bak, AbortLoading, sizeof(JMP_BUF)); + TRAP_OFF; + fclose(ff); + current_content_length = 0; + return -2; + } linelen += buf->length; showProgress(&linelen, &trbyte); } @@ -8090,16 +8096,20 @@ doFileSave(URLFile uf, char *defstr) flush_tty(); pid = fork(); if (!pid) { + int err; if ((uf.content_encoding != CMP_NOCOMPRESS) && AutoUncompress) { uncompress_stream(&uf, &tmpf); if (tmpf) unlink(tmpf); } setup_child(FALSE, 0, UFfileno(&uf)); - if (!save2tmp(uf, p) && PreserveTimestamp && uf.modtime != -1) + err = save2tmp(uf, p); + if (err == 0 && PreserveTimestamp && uf.modtime != -1) setModtime(p, uf.modtime); UFclose(&uf); unlink(lock); + if (err != 0) + exit(-err); exit(0); } addDownloadList(pid, uf.url, p, lock, current_content_length); |