Menu

#130 Better error description for files that can't be `stat`ed

1.0
closed
None
2023-04-01
2023-02-02
ashelly
No

When scanning a directory, if the call to stat fails, the error message prints the directory name but not the file that caused the error, which makes the symptom hard to debug.

A simple patch:

--- a/src/astyle_main.cpp
+++ b/src/astyle_main.cpp
@@ -1306,7 +1306,7 @@ void ASConsole::getFileNames(const string& directory, const vector<string>& wild
                                continue;
                        }
                        perror("errno message");
-                       error("Error getting file status in directory", directory.c_str());
+                       error("Error getting file status for", entryFilepath.c_str());
                }
                // skip hidden or read only
                if (entry->d_name[0] == '.' || !(statbuf.st_mode & S_IWUSR))

Discussion

  • André Simon

    André Simon - 2023-02-02
    • status: open --> accepted
    • assigned_to: André Simon
     
  • André Simon

    André Simon - 2023-04-01
    • status: accepted --> closed
     
  • André Simon

    André Simon - 2023-04-01

    applied in version 3.2.1

     

Log in to post a comment.