diff --git a/src/cond-w.c b/src/cond-w.c index d0a4bda9..f64e4a3d 100644 --- a/src/cond-w.c +++ b/src/cond-w.c @@ -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); } diff --git a/src/cond.h b/src/cond.h index e011fc31..3dcbeaad 100644 --- a/src/cond.h +++ b/src/cond.h @@ -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);