summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérémie Courrèges-Anglas <jca@wxcvbn.org>2014-01-03 02:20:58 +0100
committerJérémie Courrèges-Anglas <jca@wxcvbn.org>2014-01-03 23:06:19 +0100
commite0dcdd3634c63dd6bf4ade9f07ccef90193d17b8 (patch)
treefee40dca32c6296cdc095d8a612795dcc3555ed3
parente3e4dd2146df1d24887de3106c2b3cc4b44a5fb1 (diff)
downloadratpoison-e0dcdd3634c63dd6bf4ade9f07ccef90193d17b8.zip
Be more verbose about failures in read_startup_files().
* If we fail with errno set to something != ENOENT then an error message should probably be printed.
-rw-r--r--src/main.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/main.c b/src/main.c
index 111b591..865ba98 100644
--- a/src/main.c
+++ b/src/main.c
@@ -434,14 +434,17 @@ read_startup_files (char *alt_rcfile)
if ((fileptr = fopen (filename, "r")) == NULL)
{
- /* we probably don't need to report this, its not an error */
- PRINT_DEBUG (("ratpoison: could not open %s\n", filename));
-
- if ((fileptr = fopen ("/etc/ratpoisonrc", "r")) == NULL)
- {
- /* neither is this */
- PRINT_DEBUG (("ratpoison: could not open /etc/ratpoisonrc\n"));
- }
+ if (errno != ENOENT)
+ PRINT_ERROR (("ratpoison: could not open %s (%s)\n",
+ filename, strerror (errno)));
+
+ free (filename);
+ filename = xsprintf ("%s/ratpoisonrc", "/etc");
+
+ if ((fileptr = fopen (filename, "r")) == NULL)
+ if (errno != ENOENT)
+ PRINT_ERROR (("ratpoison: could not open %s (%s)\n",
+ filename, strerror (errno)));
}
free (filename);
}