Check-in [4d107b597a]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
SHA1 Hash:4d107b597a4c9eb9db9f76754b069726288762a4
Date: 2012-06-29 21:30:55
User: stephan
Comment:Added check of rc for setgid/setuid() calls.
Tags And Properties
Changes

Changes to src/main.c

22 #include "main.h" 22 #include "main.h" 23 #include <string.h> 23 #include <string.h> 24 #include <time.h> 24 #include <time.h> 25 #include <fcntl.h> 25 #include <fcntl.h> 26 #include <sys/types.h> 26 #include <sys/types.h> 27 #include <sys/stat.h> 27 #include <sys/stat.h> 28 #include <stdlib.h> /* atexit() */ 28 #include <stdlib.h> /* atexit() */ 29 | 29 #if !defined(_WIN32) > 30 # include <errno.h> /* errno global */ > 31 #endif 30 #if INTERFACE 32 #if INTERFACE 31 #ifdef FOSSIL_ENABLE_JSON 33 #ifdef FOSSIL_ENABLE_JSON 32 # include "cson_amalgamation.h" /* JSON API. Needed inside the INTERFACE block! 34 # include "cson_amalgamation.h" /* JSON API. Needed inside the INTERFACE block! 33 # include "json_detail.h" 35 # include "json_detail.h" 34 #endif 36 #endif 35 #ifdef FOSSIL_ENABLE_TCL 37 #ifdef FOSSIL_ENABLE_TCL 36 #include "tcl.h" 38 #include "tcl.h" ................................................................................................................................................................................ 1149 } 1151 } 1150 zDir[i] = '/'; 1152 zDir[i] = '/'; 1151 zRepo = &zDir[i]; 1153 zRepo = &zDir[i]; 1152 } 1154 } 1153 if( stat(zRepo, &sStat)!=0 ){ 1155 if( stat(zRepo, &sStat)!=0 ){ 1154 fossil_fatal("cannot stat() repository: %s", zRepo); 1156 fossil_fatal("cannot stat() repository: %s", zRepo); 1155 } 1157 } 1156 setgid(sStat.st_gid); | 1158 i = setgid(sStat.st_gid); 1157 setuid(sStat.st_uid); | 1159 i = i || setuid(sStat.st_uid); > 1160 if(i){ > 1161 fossil_fatal("setgid/uid() failed with errno %d", errno); > 1162 } 1158 if( g.db!=0 ){ 1163 if( g.db!=0 ){ 1159 db_close(1); 1164 db_close(1); 1160 db_open_repository(zRepo); 1165 db_open_repository(zRepo); 1161 } 1166 } 1162 } 1167 } 1163 #endif 1168 #endif 1164 return zRepo; 1169 return zRepo;