git: usr.bin/undo: Fix ambiguous and/or wrong error message

Tomohiro Kusumi tkusumi at
Sat Oct 10 05:46:03 PDT 2015

commit 827bb21047a339b2336fd96a42f0f05689b5ca0d
Author: Tomohiro Kusumi <kusumi.tomohiro at>
Date:   Mon Sep 28 20:46:40 2015 +0900

    usr.bin/undo: Fix ambiguous and/or wrong error message
    printf("%s: ITERATE ENTIRE HISTORY: %s\n", filename, strerror(error));
    in doiterate() doesn't necessary show an appropriate error
    There are several collect_history() calls prior to printf()
    and this printf() is only showing the result of the last one.
    Also from the way collect_history() is being used, open(2)
    failure doesn't set error to errno value (error remains 0).
    This results in printf() showing "Undefined error: 0" for an
    invalid path and possibly hiding the real errno prior to the
    last collection.
    This commit changes it to "No UNDO history found" without
    strerror(), which is never insane. The whole error handling
    needs to be changed in order to show an error message that
    is right and makes sense in every situation.
    e.g. undo -i with invalid path
      # undo -i /not/existing/path
      /not/existing/path: ITERATE ENTIRE HISTORY: Undefined error: 0

Summary of changes:
 usr.bin/undo/undo.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list