Chromium Code Reviews| Index: child_job.cc |
| diff --git a/child_job.cc b/child_job.cc |
| index 42b55d1ba804275d35aac06ac2d6f94b75fb70ae..c5ab56a6bf802d41b85c4389085c660e7d3d0879 100644 |
| --- a/child_job.cc |
| +++ b/child_job.cc |
| @@ -11,6 +11,7 @@ |
| #include <pwd.h> |
| #include <signal.h> |
| #include <stdlib.h> |
| +#include <time.h> |
| #include <unistd.h> |
| #include <base/basictypes.h> |
| @@ -36,7 +37,8 @@ SetUidExecJob::SetUidExecJob(const CommandLine* command_line, |
| num_args_passed_in_(0), |
| desired_uid_(0), |
| include_login_flag_(add_flag), |
| - set_uid_(false) { |
| + set_uid_(false), |
| + last_start_(0) { |
| PopulateArgv(command_line); |
| } |
| @@ -111,6 +113,14 @@ bool SetUidExecJob::ShouldRun() { |
| return !checker_->exists(); |
| } |
| +bool SetUidExecJob::ShouldStop() { |
| + return (time(NULL) - last_start_ < 1); |
|
DaveMoore
2010/02/27 00:56:17
Nit: could you make this a constant?
|
| +} |
| + |
| +void SetUidExecJob::RecordTime() { |
| + time(&last_start_); |
| +} |
| + |
| void SetUidExecJob::Run() { |
| UseLoginManagerFlagIfNeeded(); |
| // We try to set our UID/GID to the desired UID, and then exec |