Fix AFSPreference compile error on Mac OS 10.7

Lion llvm/clang complains about main returning void instead of int.
Fixed main to return int in DARWIN/AFSPreference/afshlp.m.
Resubmitted patch to origin/master.

Change-Id: I2f4e88ded2d98688901cc18d60abac8172942bbd
Reviewed-on: http://gerrit.openafs.org/5475
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
This commit is contained in:
Terry Long 2011-09-20 21:21:12 -04:00 committed by Derrick Brashear
parent c8f64e04b8
commit 76e0b97eaa

View File

@ -34,22 +34,22 @@
void selfRepair(char *selfPath); void selfRepair(char *selfPath);
void runWithSelfRepair(char *selfPath,int argc, char *argv[]); void runWithSelfRepair(char *selfPath,int argc, char *argv[]);
void main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
if (argc < 2) if (argc < 2)
return; // nothing to do return 1; // nothing to do
NSString *cmdString = [NSString stringWithCString:(const char *)argv[1] encoding:NSUTF8StringEncoding]; NSString *cmdString = [NSString stringWithCString:(const char *)argv[1] encoding:NSUTF8StringEncoding];
if(argc == 2 && [cmdString rangeOfString:@"stop_afs"].location!=NSNotFound ){ if(argc == 2 && [cmdString rangeOfString:@"stop_afs"].location!=NSNotFound ){
if (setuid(0) == -1) if (setuid(0) == -1)
return; return 1;
const char *stopArgs[] = {"stop", 0L}; const char *stopArgs[] = {"stop", 0L};
[[AuthUtil shared] execUnixCommand:AFS_DAEMON_STARTUPSCRIPT [[AuthUtil shared] execUnixCommand:AFS_DAEMON_STARTUPSCRIPT
args:stopArgs args:stopArgs
output:nil]; output:nil];
} else if(argc == 2 && [cmdString rangeOfString:@"start_afs"].location!=NSNotFound){ } else if(argc == 2 && [cmdString rangeOfString:@"start_afs"].location!=NSNotFound){
if (setuid(0) == -1) if (setuid(0) == -1)
return; return 1;
const char *startArgs[] = {"start", 0L}; const char *startArgs[] = {"start", 0L};
[[AuthUtil shared] execUnixCommand:AFS_DAEMON_STARTUPSCRIPT [[AuthUtil shared] execUnixCommand:AFS_DAEMON_STARTUPSCRIPT
args:startArgs args:startArgs
@ -61,7 +61,7 @@ void main(int argc, char *argv[])
[PListManager krb5TiketAtLoginTime:[[NSNumber numberWithInt:arg2] boolValue]]; [PListManager krb5TiketAtLoginTime:[[NSNumber numberWithInt:arg2] boolValue]];
} else if(argc == 3 && [cmdString rangeOfString:@"start_afs_at_startup"].location!=NSNotFound){ } else if(argc == 3 && [cmdString rangeOfString:@"start_afs_at_startup"].location!=NSNotFound){
if (setuid(0) == -1) if (setuid(0) == -1)
return; return 1;
BOOL enable = strcmp("enable", argv[2])==0; BOOL enable = strcmp("enable", argv[2])==0;
NSLog(@"Manage start_afs_at_startup with option %s from helper", argv[2]); NSLog(@"Manage start_afs_at_startup with option %s from helper", argv[2]);
[PListManager launchctlStringCommand:enable?@"load":@"unload" [PListManager launchctlStringCommand:enable?@"load":@"unload"
@ -74,6 +74,7 @@ void main(int argc, char *argv[])
printf("afshlp:afs daemon registration result:%d",checkAfsDaemon); printf("afshlp:afs daemon registration result:%d",checkAfsDaemon);
#endif #endif
} }
return 0;
} }
#if 0 #if 0