diff --git a/src/cond-w.c b/src/cond-w.c index 43be612c..2f035dc3 100644 --- a/src/cond-w.c +++ b/src/cond-w.c @@ -206,7 +206,13 @@ static int reassert(const char *fpath, const struct stat *sb, int tflg, struct F if (tflg != FTW_F) return 0; - nm = (char *)fpath + sizeof(COND_PATH); + nm = strstr((char *)fpath, COND_DIR); + if (!nm) { + _e("Incorrect condtion path %s, cannot reassert", fpath); + return 1; + } + + nm += sizeof(COND_DIR) + 1; _d("Reasserting %s => %s", fpath, nm); cond_set(nm); diff --git a/src/cond.h b/src/cond.h index a2a251c7..90378765 100644 --- a/src/cond.h +++ b/src/cond.h @@ -3,7 +3,8 @@ #include -#define COND_PATH _PATH_VARRUN "finit/cond" +#define COND_DIR "finit/cond" +#define COND_PATH _PATH_VARRUN COND_DIR #define COND_RECONF COND_PATH "/reconf" typedef enum cond_state {