diff options
author | Jérémie Courrèges-Anglas <jca@wxcvbn.org> | 2016-06-12 08:10:57 +0200 |
---|---|---|
committer | Jérémie Courrèges-Anglas <jca@wxcvbn.org> | 2016-06-12 08:12:02 +0200 |
commit | bc20d2e174a0eb7869a3592c39d0a41dbe5fe36d (patch) | |
tree | 7c41ebe6835dac2cb9630c8c0199e8871bc21d61 | |
parent | 2f7bb2cb5ea670b9dc4ef6acd3136af9f024b65c (diff) | |
download | ratpoison-bc20d2e174a0eb7869a3592c39d0a41dbe5fe36d.zip |
Simplify config file open checks
-rw-r--r-- | src/main.c | 20 |
1 files changed, 8 insertions, 12 deletions
@@ -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); } } |