diff --git a/src/srun/io.c b/src/srun/io.c index ca265a8ec16d8dd3bdbce00169b1885107b2f7c8..7cc2f4f1ef1223f742f437d4cf465b8aaea79eff 100644 --- a/src/srun/io.c +++ b/src/srun/io.c @@ -388,7 +388,7 @@ _stdin_open(char *filename) xassert(filename != NULL); if ((fd = open(filename, flags, 0644)) < 0) { - error ("Unable to open `%s': %m", filename); + error ("Unable to open `%s' for stdin: %m", filename); return -1; } fd_set_nonblocking(fd); @@ -400,8 +400,11 @@ static FILE * _fopen(char *filename) { FILE *fp; + + xassert(filename != NULL); + if (!(fp = fopen(filename, "w"))) - error ("Unable to open file `%s': %m", filename); + error ("Unable to open file `%s' for writing: %m", filename); return fp; } @@ -420,7 +423,7 @@ _open_streams(job_t *job) job->outstream = stdout; if ((job->efname->type != IO_PER_TASK) && job->efname->name) - job->errstream = _fopen(job->ifname->name); + job->errstream = _fopen(job->efname->name); else job->errstream = stderr; diff --git a/src/srun/reattach.c b/src/srun/reattach.c index 9e23bcaba67f0b5cf589b7d5999dbbe7017289fe..5046631337a6a152316b39456b0b9e62bb51b3d0 100644 --- a/src/srun/reattach.c +++ b/src/srun/reattach.c @@ -199,8 +199,8 @@ _get_job_info(srun_step_t *s) for (i = 0; i < resp->record_count; i++) { job = &resp->job_array[i]; - if (job->job_id != s->jobid) - continue; + if (job->job_id == s->jobid) + break; } if (job == NULL) {