OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <errno.h> | 5 #include <errno.h> |
6 #include <stdio.h> | 6 #include <stdio.h> |
| 7 #include <stdlib.h> |
7 #include <unistd.h> | 8 #include <unistd.h> |
8 | 9 |
9 #include "base/command_line.h" | 10 #include "base/command_line.h" |
10 | 11 |
11 // Verifies that the process group id is what is expected. | 12 // Verifies that the process group id is what is expected. |
12 void CheckGid(uid_t gid) { | 13 void CheckGid(uid_t gid) { |
13 uid_t rgid; | 14 uid_t rgid; |
14 uid_t egid; | 15 uid_t egid; |
15 uid_t sgid; | 16 uid_t sgid; |
16 if (getresgid(&rgid, &egid, &sgid) != 0) { | 17 if (getresgid(&rgid, &egid, &sgid) != 0) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 CheckUid(static_cast<uid_t>(uid)); | 51 CheckUid(static_cast<uid_t>(uid)); |
51 } | 52 } |
52 | 53 |
53 if(cmd_line->HasSwitch("checkGid")) { | 54 if(cmd_line->HasSwitch("checkGid")) { |
54 int gid = atoi(cmd_line->GetSwitchValueASCII("checkGid").c_str()); | 55 int gid = atoi(cmd_line->GetSwitchValueASCII("checkGid").c_str()); |
55 CheckGid(static_cast<uid_t>(gid)); | 56 CheckGid(static_cast<uid_t>(gid)); |
56 } | 57 } |
57 | 58 |
58 return 0; | 59 return 0; |
59 } | 60 } |
OLD | NEW |