common: less const argv

This commit is contained in:
Robert Swiecki 2017-10-08 00:36:13 +02:00
parent f703d615d8
commit 6d29c196ac
3 changed files with 15 additions and 13 deletions

View File

@ -644,7 +644,8 @@ bool cmdlineParse(int argc, char *argv[], struct nsjconf_t * nsjconf)
dst = dst ? dst : optarg;
if (!mountAddMountPtTail
(nsjconf, /* src= */ optarg, dst, /* fs_type= */ "",
/* options= */ "", MS_BIND | MS_REC | MS_RDONLY, /* isDir= */
/* options= */ "", MS_BIND | MS_REC | MS_RDONLY,
/* isDir= */
NS_DIR_MAYBE, /* mandatory= */ true, NULL, NULL, NULL, 0,
/* is_symlink= */ false)) {
return false;
@ -657,7 +658,8 @@ bool cmdlineParse(int argc, char *argv[], struct nsjconf_t * nsjconf)
if (!mountAddMountPtTail
(nsjconf, /* src= */ optarg, dst, /* fs_type= */ "",
/* options= */ "", MS_BIND | MS_REC, /* isDir= */ NS_DIR_MAYBE,
/* mandatory= */ true, NULL, NULL, NULL, 0, /* is_symlink= */
/* mandatory= */ true, NULL, NULL, NULL, 0,
/* is_symlink= */
false)) {
return false;
}
@ -745,10 +747,10 @@ bool cmdlineParse(int argc, char *argv[], struct nsjconf_t * nsjconf)
}
if (nsjconf->mount_proc == true) {
if (!mountAddMountPtHead
(nsjconf, /* src= */ NULL, "/proc", "proc", "",
nsjconf->is_root_rw ? 0 : MS_RDONLY, /* isDir= */ true, /* mandatory= */ true,
NULL, NULL, NULL, 0, /* is_symlink= */ false)) {
if (!mountAddMountPtHead(nsjconf, /* src= */ NULL, "/proc", "proc", "",
nsjconf->is_root_rw ? 0 : MS_RDONLY, /* isDir= */ true,
/* mandatory= */ true,
NULL, NULL, NULL, 0, /* is_symlink= */ false)) {
return false;
}
}
@ -761,10 +763,10 @@ bool cmdlineParse(int argc, char *argv[], struct nsjconf_t * nsjconf)
return false;
}
} else {
if (!mountAddMountPtHead
(nsjconf, /* src= */ NULL, "/", "tmpfs", /* options= */ "",
nsjconf->is_root_rw ? 0 : MS_RDONLY, /* isDir= */ true, /* mandatory= */ true,
NULL, NULL, NULL, 0, /* is_symlink= */ false)) {
if (!mountAddMountPtHead(nsjconf, /* src= */ NULL, "/", "tmpfs", /* options= */ "",
nsjconf->is_root_rw ? 0 : MS_RDONLY, /* isDir= */ true,
/* mandatory= */ true,
NULL, NULL, NULL, 0, /* is_symlink= */ false)) {
return false;
}
}
@ -791,7 +793,7 @@ bool cmdlineParse(int argc, char *argv[], struct nsjconf_t * nsjconf)
}
if (argv[optind]) {
nsjconf->argv = (const char *const *)&argv[optind];
nsjconf->argv = (const char **)&argv[optind];
}
if (nsjconf->argv == NULL || nsjconf->argv[0] == NULL) {
cmdlineUsage(argv[0]);

View File

@ -122,7 +122,7 @@ struct nsjconf_t {
const char *exec_file;
const char *hostname;
const char *cwd;
const char *const *argv;
const char **argv;
int port;
const char *bindhost;
int log_fd;

View File

@ -26,7 +26,7 @@
#include "common.h"
bool containSetupFD(struct nsjconf_t *nsjconf, int fd_in, int fd_out, int fd_err);
bool containSetupFD(struct nsjconf_t * nsjconf, int fd_in, int fd_out, int fd_err);
bool containContain(struct nsjconf_t *nsjconf);
#endif /* NS_CONTAIN_H */