Projects
Browse Source     Search     Timeline     Wiki

Changeset 23355

Show
Ignore:
Timestamp:
09/05/07 08:04:36 (15 months ago)
Author:
zarzycki@…
Message:

<rdar://problem/5409386> Mac Pro SMC firmware update 1.1 does not begin after restart

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/launchd/src/StartupItems.c

    r23341 r23355  
    2727#include <sys/types.h> 
    2828#include <sys/stat.h> 
     29#include <sys/sysctl.h> 
    2930#include <sys/mman.h> 
    3031#include <stdlib.h> 
     
    218219static bool StartupItemSecurityCheck(const char *aPath) 
    219220{ 
     221        static struct timeval boot_time; 
    220222        struct stat aStatBuf; 
    221223        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        } 
    222235 
    223236        /* should use lstatx_np() on Tiger? */ 
     
    225238                if (errno != ENOENT) 
    226239                        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); 
    227244                return false; 
    228245        }