diff options
author | Cristian Toader <cristian.matei.toader@gmail.com> | 2013-08-29 15:42:30 +0300 |
---|---|---|
committer | Cristian Toader <cristian.matei.toader@gmail.com> | 2013-08-29 15:42:30 +0300 |
commit | d5f43b52546013e5fac26a1d08a9c21fb2be864a (patch) | |
tree | e7e0812c61c32d52fdcc39705dbfea7ff03c15cf /src/common/sandbox.c | |
parent | b1f7105506ca496a29fb4cdfd6f7f1a876a1e47b (diff) | |
download | tor-d5f43b52546013e5fac26a1d08a9c21fb2be864a.tar.gz tor-d5f43b52546013e5fac26a1d08a9c21fb2be864a.zip |
_array filter functions now rely on final NULL parameter
Diffstat (limited to 'src/common/sandbox.c')
-rw-r--r-- | src/common/sandbox.c | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/src/common/sandbox.c b/src/common/sandbox.c index 0bfbd012fd..49c057c2aa 100644 --- a/src/common/sandbox.c +++ b/src/common/sandbox.c @@ -731,20 +731,20 @@ sandbox_cfg_allow_stat64_filename(sandbox_cfg_t **cfg, char *file, int fr) } int -sandbox_cfg_allow_stat64_filename_array(sandbox_cfg_t **cfg, int num, ...) +sandbox_cfg_allow_stat64_filename_array(sandbox_cfg_t **cfg, ...) { - int rc = 0, i; + int rc = 0; + char *fn = NULL; va_list ap; - va_start(ap, num); + va_start(ap, cfg); - for (i = 0; i < num; i++) { - char *fn = va_arg(ap, char*); + while((fn = va_arg(ap, char*)) != NULL) { int fr = va_arg(ap, int); rc = sandbox_cfg_allow_stat64_filename(cfg, fn, fr); if (rc) { - log_err(LD_BUG,"(Sandbox) failed on par %d", i); + log_err(LD_BUG,"(Sandbox) sandbox_cfg_allow_stat64_filename_array fail"); goto end; } } @@ -775,20 +775,20 @@ sandbox_cfg_allow_open_filename(sandbox_cfg_t **cfg, char *file, int fr) } int -sandbox_cfg_allow_open_filename_array(sandbox_cfg_t **cfg, int num, ...) +sandbox_cfg_allow_open_filename_array(sandbox_cfg_t **cfg, ...) { - int rc = 0, i; + int rc = 0; + char *fn = NULL; va_list ap; - va_start(ap, num); + va_start(ap, cfg); - for (i = 0; i < num; i++) { - char *fn = va_arg(ap, char*); + while((fn = va_arg(ap, char*)) != NULL) { int fr = va_arg(ap, int); rc = sandbox_cfg_allow_open_filename(cfg, fn, fr); if (rc) { - log_err(LD_BUG,"(Sandbox) failed on par %d", i); + log_err(LD_BUG,"(Sandbox) sandbox_cfg_allow_open_filename_array fail"); goto end; } } @@ -818,20 +818,20 @@ sandbox_cfg_allow_openat_filename(sandbox_cfg_t **cfg, char *file, int fr) } int -sandbox_cfg_allow_openat_filename_array(sandbox_cfg_t **cfg, int num, ...) +sandbox_cfg_allow_openat_filename_array(sandbox_cfg_t **cfg, ...) { - int rc = 0, i; + int rc = 0; + char *fn = NULL; va_list ap; - va_start(ap, num); + va_start(ap, cfg); - for (i = 0; i < num; i++) { - char *fn = va_arg(ap, char*); + while((fn = va_arg(ap, char*)) != NULL) { int fr = va_arg(ap, int); rc = sandbox_cfg_allow_openat_filename(cfg, fn, fr); if (rc) { - log_err(LD_BUG,"(Sandbox) failed on par %d", i); + log_err(LD_BUG,"(Sandbox) sandbox_cfg_allow_openat_filename_array fail"); goto end; } } @@ -859,20 +859,19 @@ sandbox_cfg_allow_execve(sandbox_cfg_t **cfg, char *com) } int -sandbox_cfg_allow_execve_array(sandbox_cfg_t **cfg, int num, ...) +sandbox_cfg_allow_execve_array(sandbox_cfg_t **cfg, ...) { - int rc = 0, i; + int rc = 0; + char *fn = NULL; va_list ap; - va_start(ap, num); + va_start(ap, cfg); - for (i = 0; i < num; i++) { - char *fn = va_arg(ap, char*); + while((fn = va_arg(ap, char*)) != NULL) { rc = sandbox_cfg_allow_execve(cfg, fn); - if (rc) { - log_err(LD_BUG,"(Sandbox) failed on par %d", i); + log_err(LD_BUG,"(Sandbox) sandbox_cfg_allow_execve_array failed"); goto end; } } |