Fix some error output, replacing some silly 'warnx("\n...")' with
authorkrw <krw@openbsd.org>
Fri, 7 Oct 2022 19:59:19 +0000 (19:59 +0000)
committerkrw <krw@openbsd.org>
Fri, 7 Oct 2022 19:59:19 +0000 (19:59 +0000)
fprintf(stderr, "\n...").

Reported by Michael Siegel via bugs@. ok tb@ (with some further suggestions)

usr.bin/cdio/rip.c

index a655a28..3ff1c8e 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: rip.c,v 1.18 2019/06/28 13:35:00 deraadt Exp $        */
+/*     $OpenBSD: rip.c,v 1.19 2022/10/07 19:59:19 krw Exp $    */
 
 /*
  * Copyright (c) 2007 Alexey Vatchenko <av@bsdua.org>
@@ -394,22 +394,23 @@ read_track(struct track *ti)
                        if (ti->fd >= 0 &&
                            (write_sector(ti->fd, sec, blksize) != 0)) {
                                free(sec);
-                               warnx("\nerror while writing to the %s file",
-                                   ti->name);
+                               fprintf(stderr, "\nerror while writing to the "
+                                   "%s file\n", ti->name);
                                return (-1);
                        }
                        if (ti->hdl != NULL &&
                            (sio_write(ti->hdl, sec, blksize) == 0)) {
                                sio_close(ti->hdl);
                                ti->hdl = NULL;
-                               warnx("\nerror while writing to audio output");
+                               fprintf(stderr, "\nerror while writing to audio "
+                                   "output\n");
                                return (-1);
                        }
 
                        i++;
                } else if (error != EAGAIN) {
                        free(sec);
-                       warnx("\nerror while reading from device");
+                       fprintf(stderr, "\nerror while reading from device\n");
                        return (-1);
                }
        }
@@ -565,7 +566,7 @@ rip_tracks_loop(struct track_pair *tp, u_int n_tracks,
                                        info.fd = -1;
                                }
                                if (error != 0) {
-                                       warnx("can't rip %u track",
+                                       fprintf(stderr, "can't rip track %u\n",
                                            toc_buffer[i].track);
                                        break;
                                }