fauxsu.cc needs #include <unistd.h>
Created by: nieder
On OS X 10.9, compiling fauxsu.cc fails with this error:
g++ -c -DTARGET_MACOSX=1 -O2 -I/sw/build.build/fauxsu-0.9-1/fauxsu-0.9/theos/include -include /sw/build.build/fauxsu-0.9-1/fauxsu-0.9/theos/Prefix.pch -Wall -arch i386 -arch x86_64 -Wno-format -Wno-sign-compare fauxsu.cc -o obj/macosx/fauxsu.cc.o
fauxsu.cc:126:12: error: use of undeclared identifier 'chown'
int ret = chown(path, owner, group);
^
fauxsu.cc:135:12: error: use of undeclared identifier 'fchown'
int ret = fchown(fildes, owner, group);
^
fauxsu.cc:144:12: error: use of undeclared identifier 'lchown'
int ret = lchown(path, owner, group);
^
fauxsu.cc:176:31: error: use of undeclared identifier 'PATH_MAX'
static char _persist_filename[PATH_MAX] = "";
^
fauxsu.cc:180:15: error: use of undeclared identifier 'getenv'
char *env = getenv("_FAUXSU_PERSIST_FILENAME");
^
fauxsu.cc:244:30: error: use of undeclared identifier 'chown'
{ (void *)my_chown, (void *)chown },
^
fauxsu.cc:245:31: error: use of undeclared identifier 'fchown'
{ (void *)my_fchown, (void *)fchown },
^
fauxsu.cc:246:31: error: use of undeclared identifier 'lchown'
{ (void *)my_lchown, (void *)lchown },
^
fauxsu.cc:250:30: error: use of undeclared identifier 'getuid'
{ (void*)my_getuid, (void *)getuid },
^
fauxsu.cc:251:31: error: use of undeclared identifier 'geteuid'
{ (void*)my_geteuid, (void *)geteuid },
^
fauxsu.cc:252:30: error: use of undeclared identifier 'getgid'
{ (void*)my_getgid, (void *)getgid },
^
fauxsu.cc:253:31: error: use of undeclared identifier 'getegid'
{ (void*)my_getegid, (void *)getegid },
^
12 errors generated.
The *id and *chown identifiers are fixed by #including <unistd.h>
, which is no longer implicitly added by the OS X 10.9 toolchain. getenv is satisfied with #include <stdlib.h>
. PATH_MAX needs #include <limits.h>