aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNable 80 <nable.maininbox@googlemail.com>2015-01-03 20:47:51 (GMT)
committerMathias Gumz <akira@fluxbox.org>2015-01-03 20:47:51 (GMT)
commitad968e32b30ee6262574bc3e02b20d5b117f5b88 (patch)
tree723a33fd5e22ae3aae3ffd2b1eb526abf17e3269 /src
parent90f2fcf031554577ce811e7f7151f2a78ea7a265 (diff)
downloadfluxbox-ad968e32b30ee6262574bc3e02b20d5b117f5b88.zip
fluxbox-ad968e32b30ee6262574bc3e02b20d5b117f5b88.tar.bz2
Fix to make clang happy
POSIX states that 'd_name' in 'struct dirent' is char[], so it cannot be NULL. This will result in the compiler complainting about an expression which always evaluates to true ... for this compiler (clang). But in some implementations 'd_name' is a 'char*' that's why it's better to keep the check for possible NULL.
Diffstat (limited to 'src')
-rw-r--r--src/FbTk/FileUtil.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/FbTk/FileUtil.cc b/src/FbTk/FileUtil.cc
index c92b336..5ae2bc0 100644
--- a/src/FbTk/FileUtil.cc
+++ b/src/FbTk/FileUtil.cc
@@ -112,9 +112,11 @@ struct dirent *Directory::read() {
112 112
113std::string Directory::readFilename() { 113std::string Directory::readFilename() {
114 dirent *ent = read(); 114 dirent *ent = read();
115 if (ent == 0) 115 const char* name = 0;
116 return ""; 116 if (ent) {
117 return (ent->d_name ? ent->d_name : ""); 117 name = ent->d_name;
118 }
119 return (name ? name : "");
118} 120}
119 121
120void Directory::close() { 122void Directory::close() {