Fix more style issues.
BUG=None
TEST=unit
Change-Id: I89f7288e9b3226273232d99f1c0176b69ce3b300
Reviewed-on: https://chromium-review.googlesource.com/203971
Reviewed-by: Lee Campbell <leecam@chromium.org>
Tested-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
diff --git a/elfparse.c b/elfparse.c
index 5dd919d..648178e 100644
--- a/elfparse.c
+++ b/elfparse.c
@@ -99,6 +99,11 @@
ret = ELFDYNAMIC;
}
} else {
+ /*
+ * The file is smaller than |HEADERSIZE| bytes.
+ * We assume it's a short script. See above for
+ * reasoning on scripts.
+ */
ret = ELFDYNAMIC;
}
fclose(elf_file);
diff --git a/libminijail.c b/libminijail.c
index 8585265..4e56b3e 100644
--- a/libminijail.c
+++ b/libminijail.c
@@ -563,7 +563,7 @@
pdie("bind: %s -> %s", b->src, dest);
if (!b->writeable) {
ret = mount(b->src, dest, NULL,
- MS_BIND | MS_REMOUNT | MS_RDONLY, NULL);
+ MS_BIND | MS_REMOUNT | MS_RDONLY, NULL);
if (ret)
pdie("bind ro: %s -> %s", b->src, dest);
}
diff --git a/libminijail.h b/libminijail.h
index 67442bd..865a4f1 100644
--- a/libminijail.h
+++ b/libminijail.h
@@ -85,7 +85,7 @@
* of minijail_bind() calls.
*/
int minijail_bind(struct minijail *j, const char *src, const char *dest,
- int writeable);
+ int writeable);
/* Lock this process into the given minijail. Note that this procedure cannot fail,
* since there is no way to undo privilege-dropping; therefore, if any part of
diff --git a/minijail0.c b/minijail0.c
index 88c8051..e5ca3d1 100644
--- a/minijail0.c
+++ b/minijail0.c
@@ -67,7 +67,7 @@
exit(1);
}
if (minijail_bind(j, src, dest, flags ? atoi(flags) : 0)) {
- fprintf(stderr, "Bind failure\n");
+ fprintf(stderr, "Bind failure.\n");
exit(1);
}
}
@@ -231,7 +231,7 @@
argv += consumed;
/* Check that we can access the target program. */
if (access(argv[0], X_OK)) {
- fprintf(stderr, "Target program '%s' not accessible\n",
+ fprintf(stderr, "Target program '%s' is not accessible.\n",
argv[0]);
return 1;
}
@@ -254,8 +254,9 @@
}
minijail_run(j, argv[0], argv);
} else {
- fprintf(stderr, "Target program '%s' is not an ELF executable.\n",
- argv[0]);
+ fprintf(stderr,
+ "Target program '%s' is not a valid ELF file.\n",
+ argv[0]);
return 1;
}
diff --git a/util.h b/util.h
index 2740ab3..04b9465 100644
--- a/util.h
+++ b/util.h
@@ -13,18 +13,18 @@
#include <syslog.h>
#define die(_msg, ...) do { \
- syslog(LOG_ERR, "libminijail: " _msg, ## __VA_ARGS__); \
- abort(); \
+ syslog(LOG_ERR, "libminijail: " _msg, ## __VA_ARGS__); \
+ abort(); \
} while (0)
#define pdie(_msg, ...) \
- die(_msg ": %s", ## __VA_ARGS__, strerror(errno))
+ die(_msg ": %s", ## __VA_ARGS__, strerror(errno))
#define warn(_msg, ...) \
- syslog(LOG_WARNING, "libminijail: " _msg, ## __VA_ARGS__)
+ syslog(LOG_WARNING, "libminijail: " _msg, ## __VA_ARGS__)
#define info(_msg, ...) \
- syslog(LOG_INFO, "libminijail: " _msg, ## __VA_ARGS__)
+ syslog(LOG_INFO, "libminijail: " _msg, ## __VA_ARGS__)
extern const char *log_syscalls[];
extern const size_t log_syscalls_len;