Commit d10e0e4d authored by Ahmad Samir's avatar Ahmad Samir Committed by Nate Graham
Browse files

KRDB: don't use access() system call

Its manual page says it's insecure and should be avoided. Instead just
check the file exists.
parent 30d6726f
......@@ -58,6 +58,9 @@
#endif
#include <X11/Xlib.h>
#endif
#include <filesystem>
inline const char *gtkEnvVar(int version)
{
return 2 == version ? "GTK2_RC_FILES" : "GTK_RC_FILES";
......@@ -65,16 +68,18 @@ inline const char *gtkEnvVar(int version)
inline const char *sysGtkrc(int version)
{
if (2 == version) {
if (access("/etc/opt/gnome/gtk-2.0", F_OK) == 0)
if (version == 2) {
if (std::filesystem::exists("/etc/opt/gnome/gtk-2.0")) {
return "/etc/opt/gnome/gtk-2.0/gtkrc";
else
} else {
return "/etc/gtk-2.0/gtkrc";
}
} else {
if (access("/etc/opt/gnome/gtk", F_OK) == 0)
if (std::filesystem::exists("/etc/opt/gnome/gtk")) {
return "/etc/opt/gnome/gtk/gtkrc";
else
} else {
return "/etc/gtk/gtkrc";
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment