Changeset 894

Show
Ignore:
Timestamp:
05/11/08 22:18:36 (4 months ago)
Author:
takkaria
Message:

Make OS X always give us the correct home directory. Fixes #384, with thanks to Rowan Beentje, roustk, and Kenneth Boyd.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/Makefile.osx

    r830 r894  
    3232        -DPRIVATE_USER_PATH=\"~/Library/Preferences\" -DUSE_PRIVATE_PATHS \ 
    3333        -arch ppc -arch i386 -mmacosx-version-min=10.0 
    34 LIBS = -framework CoreFoundation -framework QuickTime -framework Carbon 
     34LIBS = -framework CoreFoundation -framework QuickTime -framework Carbon -framework SystemConfiguration 
    3535 
    3636# 
  • trunk/src/z-file.c

    r759 r894  
    3030#endif 
    3131 
     32#ifdef MACH_O_CARBON 
     33# include <SystemConfiguration/SCDynamicStoreCopySpecific.h> 
     34#endif 
     35 
    3236#ifdef HAVE_FCNTL_H 
    3337# include <fcntl.h> 
     
    149153 
    150154                /* Look up a user (or "current" user) */ 
     155#ifndef MACH_O_CARBON 
    151156                if (username) pw = getpwnam(username); 
    152157                else          pw = getpwuid(getuid()); 
    153158 
     159#else /* MACH_O_CARBON */ 
     160 
     161                /* On Macs look up the console user to avoid problems with invalid root detection */ 
     162                uid_t uid; 
     163                SCDynamicStoreCopyConsoleUser(NULL, &uid, NULL); 
     164                pw = getpwuid(uid); 
     165#endif /* !MACH_O_CARBON */ 
     166                 
    154167                if (!pw) return; 
    155168