SCP: Fix dangling perror details
This commit is contained in:
parent
41978eca80
commit
1548777278
5 changed files with 14 additions and 8 deletions
|
@ -350,7 +350,7 @@ if (feof (cdr_unit.fileref)) /* eof? */
|
|||
return STOP_NOCD;
|
||||
if (ferror (cdr_unit.fileref)) { /* error? */
|
||||
ind[IN_RDCHK] = 1; /* set read check */
|
||||
sim_printf ("CDR I/O error: %s", strerror (errno));
|
||||
sim_perror ("CDR I/O error");
|
||||
clearerr (cdr_unit.fileref);
|
||||
return SCPE_IOERR;
|
||||
}
|
||||
|
@ -533,7 +533,7 @@ fputs (cdp_buf, cdp_unit.fileref); /* write card */
|
|||
cdp_unit.pos = ftell (cdp_unit.fileref); /* count char */
|
||||
if (ferror (cdp_unit.fileref)) { /* error? */
|
||||
ind[IN_WRCHK] = 1;
|
||||
sim_printf ("CDR I/O error: %s", strerror (errno));
|
||||
sim_perror ("CDR I/O error");
|
||||
clearerr (cdp_unit.fileref);
|
||||
return SCPE_IOERR;
|
||||
}
|
||||
|
|
|
@ -264,7 +264,7 @@ if (lpt_bptr) { /* any line? */
|
|||
lpt_buf_init (); /* reinit buf */
|
||||
if (ferror (lpt_unit.fileref)) { /* error? */
|
||||
ind[IN_PRCHK] = ind[IN_WRCHK] = 1; /* wr, pri check */
|
||||
sim_printf ("LPT I/O error: %s", strerror (errno));
|
||||
sim_perror ("LPT I/O error");
|
||||
clearerr (lpt_unit.fileref);
|
||||
return SCPE_IOERR;
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ ind[IN_PRCH9] = CHP (9, cct[cct_ptr]) != 0; /* set indicators */
|
|||
ind[IN_PRCH12] = CHP (12, cct[cct_ptr]) != 0;
|
||||
if (ferror (lpt_unit.fileref)) { /* error? */
|
||||
ind[IN_PRCHK] = ind[IN_WRCHK] = 1; /* wr, pri check */
|
||||
sim_printf ("LPT I/O error: %s", strerror (errno));
|
||||
sim_perror ("LPT I/O error");
|
||||
clearerr (lpt_unit.fileref);
|
||||
return SCPE_IOERR;
|
||||
}
|
||||
|
|
|
@ -334,7 +334,7 @@ do {
|
|||
if (feof (ptr_unit.fileref))
|
||||
sim_printf ("PTR end of file\n");
|
||||
else
|
||||
sim_printf ("PTR I/O error: %s", strerror (errno));
|
||||
sim_perror ("PTR I/O error");;
|
||||
clearerr (ptr_unit.fileref);
|
||||
return SCPE_IOERR;
|
||||
}
|
||||
|
@ -490,7 +490,7 @@ if ((ptp_unit.flags & UNIT_ATT) == 0) { /* attached? */
|
|||
}
|
||||
if (putc (c, ptp_unit.fileref) == EOF) { /* write char */
|
||||
ind[IN_WRCHK] = 1; /* error? */
|
||||
sim_printf ("PTP I/O error: %s", strerror (errno));
|
||||
sim_perror ("PTP I/O error");
|
||||
clearerr (ptp_unit.fileref);
|
||||
return SCPE_IOERR;
|
||||
}
|
||||
|
|
5
scp.c
5
scp.c
|
@ -9583,7 +9583,10 @@ if (buf != stackbuf)
|
|||
|
||||
void sim_perror (const char *msg)
|
||||
{
|
||||
sim_printf ("%s: %s\n", msg, strerror (errno));
|
||||
int saved_errno = errno;
|
||||
|
||||
perror (msg);
|
||||
sim_printf ("%s: %s\n", msg, strerror (saved_errno));
|
||||
}
|
||||
|
||||
/* Print command result message to stdout, sim_log (if enabled) and sim_deb (if enabled) */
|
||||
|
|
|
@ -1349,13 +1349,16 @@ return SCPE_OK;
|
|||
|
||||
t_stat sim_disk_perror (UNIT *uptr, const char *msg)
|
||||
{
|
||||
int saved_errno = errno;
|
||||
|
||||
if (!(uptr->flags & UNIT_ATTABLE)) /* not attachable? */
|
||||
return SCPE_NOATT;
|
||||
switch (DK_GET_FMT (uptr)) { /* case on format */
|
||||
case DKUF_F_STD: /* SIMH format */
|
||||
case DKUF_F_VHD: /* VHD format */
|
||||
case DKUF_F_RAW: /* Raw Physical Disk Access */
|
||||
sim_printf ("%s %s: %s\n", sim_uname(uptr), msg, strerror(errno));
|
||||
perror (msg);
|
||||
sim_printf ("%s %s: %s\n", sim_uname(uptr), msg, strerror(saved_errno));
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue