Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1172)

Unified Diff: sandbox/linux/suid/linux_util.c

Issue 236083002: Linux sandbox: style cleanup for setuid sandbox. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Also fix header inclusions. Ohh goodness. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sandbox/linux/suid/common/suid_unsafe_environment_variables.h ('k') | sandbox/linux/suid/process_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/linux/suid/linux_util.c
diff --git a/sandbox/linux/suid/linux_util.c b/sandbox/linux/suid/linux_util.c
index 256468ff4ea1b53d366b56087e82ba3c41c56785..320f6ca37429fd4fe5ba9429ad547354a16047ed 100644
--- a/sandbox/linux/suid/linux_util.c
+++ b/sandbox/linux/suid/linux_util.c
@@ -5,8 +5,9 @@
// The following is duplicated from base/linux_utils.cc.
// We shouldn't link against C++ code in a setuid binary.
+#include "sandbox/linux/suid/linux_util.h"
+
#define _GNU_SOURCE // For O_DIRECTORY
-#include "linux_util.h"
#include <dirent.h>
#include <errno.h>
@@ -26,7 +27,8 @@ static const char kSocketLinkPrefix[] = "socket:[";
// socket.
// inode_out: (output) set to the inode number on success
// path: e.g. /proc/1234/fd/5 (must be a UNIX domain socket descriptor)
-static bool ProcPathGetInodeAt(ino_t* inode_out, int base_dir_fd,
+static bool ProcPathGetInodeAt(ino_t* inode_out,
+ int base_dir_fd,
const char* path) {
// We also check that the path is relative.
if (!inode_out || !path || *path == '/')
@@ -40,7 +42,7 @@ static bool ProcPathGetInodeAt(ino_t* inode_out, int base_dir_fd,
if (memcmp(kSocketLinkPrefix, buf, sizeof(kSocketLinkPrefix) - 1))
return false;
- char *endptr = NULL;
+ char* endptr = NULL;
errno = 0;
const unsigned long long int inode_ull =
strtoull(buf + sizeof(kSocketLinkPrefix) - 1, &endptr, 10);
@@ -72,7 +74,7 @@ bool FindProcessHoldingSocket(pid_t* pid_out, ino_t socket_inode) {
const uid_t uid = getuid();
struct dirent* dent;
while ((dent = readdir(proc))) {
- char *endptr = NULL;
+ char* endptr = NULL;
errno = 0;
const unsigned long int pid_ul = strtoul(dent->d_name, &endptr, 10);
if (pid_ul == ULONG_MAX || !endptr || *endptr || errno != 0)
« no previous file with comments | « sandbox/linux/suid/common/suid_unsafe_environment_variables.h ('k') | sandbox/linux/suid/process_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698