Changeset 23355
- Timestamp:
- 09/05/07 08:04:36 (15 months ago)
- Files:
-
- 1 modified
-
trunk/launchd/src/StartupItems.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/launchd/src/StartupItems.c
r23341 r23355 27 27 #include <sys/types.h> 28 28 #include <sys/stat.h> 29 #include <sys/sysctl.h> 29 30 #include <sys/mman.h> 30 31 #include <stdlib.h> … … 218 219 static bool StartupItemSecurityCheck(const char *aPath) 219 220 { 221 static struct timeval boot_time; 220 222 struct stat aStatBuf; 221 223 bool r = true; 224 225 if (boot_time.tv_sec == 0) { 226 int mib[] = { CTL_KERN, KERN_BOOTTIME }; 227 size_t boot_time_sz = sizeof(boot_time); 228 int rv; 229 230 rv = sysctl(mib, sizeof(mib) / sizeof(mib[0]), &boot_time, &boot_time_sz, NULL, 0); 231 232 assert(rv != -1); 233 assert(boot_time_sz == sizeof(boot_time)); 234 } 222 235 223 236 /* should use lstatx_np() on Tiger? */ … … 225 238 if (errno != ENOENT) 226 239 syslog(LOG_ERR, "lstat(\"%s\"): %m", aPath); 240 return false; 241 } 242 if (aStatBuf.st_ctimespec.tv_sec > boot_time.tv_sec) { 243 syslog(LOG_WARNING, "\"%s\" failed sanity check: path was created after boot up", aPath); 227 244 return false; 228 245 }

