Fix coding style issues.
BUG=None
TEST=Compile
Change-Id: Ic4515367a4b05be8410596c5159e4c6ddab8e798
Reviewed-on: https://chromium-review.googlesource.com/203719
Tested-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Reviewed-by: Lee Campbell <leecam@chromium.org>
Commit-Queue: Jorge Lucangeli Obes <jorgelo@chromium.org>
diff --git a/libminijail.c b/libminijail.c
index d4b9d16..8585265 100644
--- a/libminijail.c
+++ b/libminijail.c
@@ -67,8 +67,8 @@
struct minijail {
/*
- * WARNING: if you add a flag here you need to make sure it's accounted for
- * in minijail_pre{enter|exec}() below.
+ * WARNING: if you add a flag here you need to make sure it's
+ * accounted for in minijail_pre{enter|exec}() below.
*/
struct {
int uid:1;
@@ -277,7 +277,8 @@
j->flags.ptrace = 1;
}
-int API minijail_enter_chroot(struct minijail *j, const char *dir) {
+int API minijail_enter_chroot(struct minijail *j, const char *dir)
+{
if (j->chrootdir)
return -EINVAL;
j->chrootdir = strdup(dir);
@@ -293,7 +294,8 @@
}
int API minijail_bind(struct minijail *j, const char *src, const char *dest,
- int writeable) {
+ int writeable)
+{
struct binding *b;
if (*dest != '/')
@@ -426,7 +428,8 @@
*
* Returns a pointer to the base of the bytes, or NULL for errors.
*/
-void *consumebytes(size_t length, char **buf, size_t *buflength) {
+void *consumebytes(size_t length, char **buf, size_t *buflength)
+{
char *p = *buf;
if (length > *buflength)
return NULL;
@@ -441,7 +444,8 @@
*
* Returns a pointer to the base of the string, or NULL for errors.
*/
-char *consumestr(char **buf, size_t *buflength) {
+char *consumestr(char **buf, size_t *buflength)
+{
size_t len = strnlen(*buf, *buflength);
if (len == *buflength)
/* There's no null-terminator */
@@ -545,7 +549,8 @@
*
* Returns 0 for success.
*/
-int bind_one(const struct minijail *j, struct binding *b) {
+int bind_one(const struct minijail *j, struct binding *b)
+{
int ret = 0;
char *dest = NULL;
if (ret)
@@ -568,7 +573,8 @@
return ret;
}
-int enter_chroot(const struct minijail *j) {
+int enter_chroot(const struct minijail *j)
+{
int ret;
if (j->bindings_head && (ret = bind_one(j, j->bindings_head)))
return ret;
diff --git a/minijail0.c b/minijail0.c
index 4987001..88c8051 100644
--- a/minijail0.c
+++ b/minijail0.c
@@ -57,7 +57,8 @@
minijail_use_caps(j, caps);
}
-static void add_binding(struct minijail *j, char *arg) {
+static void add_binding(struct minijail *j, char *arg)
+{
char *src = strtok(arg, ",");
char *dest = strtok(NULL, ",");
char *flags = strtok(NULL, ",");
@@ -82,7 +83,6 @@
"instances allowed\n"
" -c <caps>: restrict caps to <caps>\n"
" -C <dir>: chroot to <dir>\n"
- " -t: mount tmpfs at /tmp inside chroot\n"
" -e: enter a network namespace\n"
" -G: inherit secondary groups from uid\n"
" -g <group>: change gid to <group>\n"
@@ -103,6 +103,7 @@
" -s: use seccomp\n"
" -S <file>: set seccomp filter using <file>\n"
" E.g., -S /usr/share/filters/<prog>.$(uname -m)\n"
+ " -t: mount tmpfs at /tmp inside chroot\n"
" -u <user>: change uid to <user>\n"
" -v: use vfs namespace\n");
}
@@ -231,7 +232,7 @@
/* Check that we can access the target program. */
if (access(argv[0], X_OK)) {
fprintf(stderr, "Target program '%s' not accessible\n",
- argv[0]);
+ argv[0]);
return 1;
}
/* Check if target is statically or dynamically linked. */
diff --git a/syscall_filter.c b/syscall_filter.c
index 9d4ad58..70fff07 100644
--- a/syscall_filter.c
+++ b/syscall_filter.c
@@ -112,7 +112,8 @@
append_filter_block(head, filter, ONE_INSTR);
}
-void append_allow_syscall(struct filter_block *head, int nr) {
+void append_allow_syscall(struct filter_block *head, int nr)
+{
struct sock_filter *filter = new_instr_buf(ALLOW_SYSCALL_LEN);
size_t len = bpf_allow_syscall(filter, nr);
if (len != ALLOW_SYSCALL_LEN)
@@ -204,7 +205,8 @@
return 0;
}
-int compile_errno(struct filter_block *head, char *ret_errno) {
+int compile_errno(struct filter_block *head, char *ret_errno)
+{
char *errno_ptr;
/* Splits the 'return' keyword and the actual errno value. */
diff --git a/util.c b/util.c
index 680d8f1..f05bf07 100644
--- a/util.c
+++ b/util.c
@@ -68,7 +68,8 @@
return s;
}
-char *tokenize(char **stringp, const char *delim) {
+char *tokenize(char **stringp, const char *delim)
+{
char *ret = NULL;
/* If the string is NULL or empty, there are no tokens to be found. */