42362: protect REPORTTIME logic from bad status

This commit is contained in:
Peter Stephenson 2018-02-17 22:35:32 +00:00
parent 7492f1e9ed
commit 5b946f6c4d
2 changed files with 7 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2018-02-17 Peter Stephenson <p.w.stephenson@ntlworld.com>
* 42362: Src/jobs.c: protet REPORTTIME logic from bad status.
2018-02-13 Peter Stephenson <p.stephenson@samsung.com>
* Eitan Adler: Doc/Zsh/params.yo: REPORTMEMORY is in kilobytes,

View File

@ -925,6 +925,7 @@ should_report_time(Job j)
struct value vbuf;
Value v;
char *s = "REPORTTIME";
int save_errflag = errflag;
zlong reporttime = -1;
#ifdef HAVE_GETRUSAGE
char *sm = "REPORTMEMORY";
@ -936,12 +937,14 @@ should_report_time(Job j)
return 1;
queue_signals();
errflag = 0;
if ((v = getvalue(&vbuf, &s, 0)))
reporttime = getintvalue(v);
#ifdef HAVE_GETRUSAGE
if ((v = getvalue(&vbuf, &sm, 0)))
reportmemory = getintvalue(v);
#endif
errflag = save_errflag;
unqueue_signals();
if (reporttime < 0
#ifdef HAVE_GETRUSAGE