summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorJérémie Courrèges-Anglas <jca@wxcvbn.org>2016-06-12 08:10:57 +0200
committerJérémie Courrèges-Anglas <jca@wxcvbn.org>2016-06-12 08:12:02 +0200
commitbc20d2e174a0eb7869a3592c39d0a41dbe5fe36d (patch)
tree7c41ebe6835dac2cb9630c8c0199e8871bc21d61 /src/main.c
parent2f7bb2cb5ea670b9dc4ef6acd3136af9f024b65c (diff)
downloadratpoison-bc20d2e174a0eb7869a3592c39d0a41dbe5fe36d.zip
Simplify config file open checks
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/main.c b/src/main.c
index 11d7ca0..3ca8ee6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -441,12 +441,10 @@ read_startup_files (const char *alt_rcfile)
else
{
filename = xsprintf ("%s/.ratpoisonrc", homedir);
- if ((fileptr = fopen (filename, "r")) == NULL)
- {
- if (errno != ENOENT)
- PRINT_ERROR (("ratpoison: could not open %s (%s)\n",
- filename, strerror (errno)));
- }
+ fileptr = fopen (filename, "r");
+ if (fileptr == NULL && errno != ENOENT)
+ PRINT_ERROR (("ratpoison: could not open %s (%s)\n",
+ filename, strerror (errno)));
free (filename);
}
@@ -455,12 +453,10 @@ read_startup_files (const char *alt_rcfile)
/* couldn't open $HOME/.ratpoisonrc, fall back on system config */
filename = xsprintf ("%s/ratpoisonrc", SYSCONFDIR);
- if ((fileptr = fopen (filename, "r")) == NULL)
- {
- if (errno != ENOENT)
- PRINT_ERROR (("ratpoison: could not open %s (%s)\n",
- filename, strerror (errno)));
- }
+ fileptr = fopen (filename, "r");
+ if (fileptr == NULL && errno != ENOENT)
+ PRINT_ERROR (("ratpoison: could not open %s (%s)\n",
+ filename, strerror (errno)));
free (filename);
}
}