New function to create onshot conds without updating

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2021-05-16 23:37:41 +02:00
parent d13e39e345
commit 57ca937f27
2 changed files with 17 additions and 4 deletions
+16 -4
View File
@@ -199,21 +199,33 @@ void cond_set(const char *name)
cond_update(name);
}
void cond_set_oneshot(const char *name)
int cond_set_oneshot_noupdate(const char *name)
{
const char *path;
if (string_compare(name, "nop"))
return;
return 1;
path = cond_path(name);
_d("%s => %s", name, path);
if (cond_checkpath(path))
return 1;
if (symlink(_PATH_RECONF, path) && errno != EEXIST) {
_pe("Failed creating onshot cond %s", name);
return 1;
}
return 0;
}
void cond_set_oneshot(const char *name)
{
_d("%s", name);
if (cond_set_oneshot_noupdate(name))
return;
if (symlink(_PATH_RECONF, path) && errno != EEXIST)
_pe("Failed creating onshot cond %s", name);
cond_update(name);
}
+1
View File
@@ -38,6 +38,7 @@ void cond_clear (const char *name);
void cond_reload (void);
int cond_set_noupdate (const char *name);
int cond_set_oneshot_noupdate(const char *name);
int cond_clear_noupdate(const char *name);
void cond_reassert (const char *pat);