Verified Commit 5225e3e5 authored by Karel Koci's avatar Karel Koci 🤘
Browse files

Suppress some warnings

parent 368ed134
/*
* Copyright 2016-2017, CZ.NIC z.s.p.o. (http://www.nic.cz/)
* Copyright 2016-2018, CZ.NIC z.s.p.o. (http://www.nic.cz/)
*
* This file is part of the turris updater.
*
......@@ -139,10 +139,12 @@ static bool journal_open(lua_State *L, int flags) {
switch (errno) {
case EEXIST:
luaL_error(L, "Unfinished journal exists");
FALLTROUGH;
case ENOENT:
if (!(flags & O_CREAT))
return false;
// Otherwise ‒ fall through to the default section
FALLTROUGH;
default:
luaL_error(L, "Error opening journal: %s", strerror(errno));
}
......
/*
* Copyright 2016, CZ.NIC z.s.p.o. (http://www.nic.cz/)
* Copyright 2016-2018, CZ.NIC z.s.p.o. (http://www.nic.cz/)
*
* This file is part of the turris updater.
*
......@@ -57,9 +57,10 @@ void exec_hook(const char *dir, const char *message) {
char *fpath = aprintf("%s/%s", dir, namelist[i]->d_name);
char *msg = aprintf("%s: %s", message, namelist[i]->d_name);
// TODO do we want to have some timeout here?
if (!access(fpath, X_OK))
lsubprocv(LST_HOOK, msg, NULL, -1, fpath, NULL);
else
if (!access(fpath, X_OK)) {
const char *args[] = {NULL};
lsubprocl(LST_HOOK, msg, NULL, -1, fpath, args);
} else
DBG("File not executed, not executable: %s", namelist[i]->d_name);
free(namelist[i]);
}
......
/*
* Copyright 2016, CZ.NIC z.s.p.o. (http://www.nic.cz/)
* Copyright 2016-2018, CZ.NIC z.s.p.o. (http://www.nic.cz/)
*
* This file is part of the turris updater.
*
......@@ -56,4 +56,12 @@ char *printf_into(char *dst, const char *msg, ...) __attribute__((format(printf,
// Like printf, but allocates the data on the stack with alloca and returns. It uses the arguments multiple times, so beware of side effects.
#define aprintf(...) printf_into(alloca(printf_len(__VA_ARGS__)), __VA_ARGS__)
// GCC 7+ reports fall troughs but previous versions doesn't understand attribute
// for it so we have this macro to not put it in place if it's not needed.
#if __GNUC__ >= 7
#define FALLTROUGH __attribute__((fallthrough))
#else
#define FALLTROUGH
#endif
#endif
Markdown is supported
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