Small bug in reboot error reporting - Minix

This is a discussion on Small bug in reboot error reporting - Minix ; Dear all, After getting a message "Unknown error: reboot(): esday" when the "reboot" program failed, I found this line in commands/reboot/halt.c: fprintf(stderr, "%s: reboot(): %s\n", strerror(errno)); This is wrong, as there are more format strings than arguments, causing the second ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Small bug in reboot error reporting

  1. Small bug in reboot error reporting

    Dear all,

    After getting a message "Unknown error: reboot(): esday" when the
    "reboot" program failed, I found this line in commands/reboot/halt.c:

    fprintf(stderr, "%s: reboot(): %s\n", strerror(errno));

    This is wrong, as there are more format strings than arguments, causing
    the second string to show random junk (or, potentially, a segmentation
    fault).

    I think this was intended:

    fprintf(stderr, "%s: reboot(): %s\n", progr, strerror(errno));

    The source file is found here:
    https://gforge.cs.vu.nl/plugins/scms...s/r3.1.3/comma
    nds/reboot/halt.c?rev=2859&root=minix&view=markup

    The line is very close to the end (line number 131 in Minix 3.1.2).

    With kind regards,
    Erik van der Kouwe


  2. Re: Small bug in reboot error reporting

    All,

    > fprintf(stderr, "%s: reboot(): %s\n", strerror(errno));
    >
    > This is wrong, as there are more format strings than arguments, causing
    > the second string to show random junk (or, potentially, a segmentation
    > fault).
    >
    > I think this was intended:
    >
    > fprintf(stderr, "%s: reboot(): %s\n", progr, strerror(errno));


    Good find, I fixed this and other minor quirks that gcc warnings
    caught.

    =Ben



+ Reply to Thread