Fossil

Check-in [4d107b597a]
Login

Check-in [4d107b597a]

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

Overview
Comment:Added check of rc for setgid/setuid() calls.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4d107b597a4c9eb9db9f76754b069726288762a4
User & Date: stephan 2012-06-29 21:30:55.196
Context
2012-06-29
23:45
Fix a bug in the manifest generator that was introduced by check-in [01e4de6b8ae936b]. ... (check-in: 5f3a0681a0 user: drh tags: trunk)
21:30
Added check of rc for setgid/setuid() calls. ... (check-in: 4d107b597a user: stephan tags: trunk)
19:35
Remove redundant include argument from the compilation steps of several source files. ... (check-in: 8a18e7fb7f user: mistachkin tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/main.c.
22
23
24
25
26
27
28
29


30
31
32
33
34
35
36
#include "main.h"
#include <string.h>
#include <time.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h> /* atexit() */



#if INTERFACE
#ifdef FOSSIL_ENABLE_JSON
#  include "cson_amalgamation.h" /* JSON API. Needed inside the INTERFACE block! */
#  include "json_detail.h"
#endif
#ifdef FOSSIL_ENABLE_TCL
#include "tcl.h"







|
>
>







22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "main.h"
#include <string.h>
#include <time.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h> /* atexit() */
#if !defined(_WIN32)
#  include <errno.h> /* errno global */
#endif
#if INTERFACE
#ifdef FOSSIL_ENABLE_JSON
#  include "cson_amalgamation.h" /* JSON API. Needed inside the INTERFACE block! */
#  include "json_detail.h"
#endif
#ifdef FOSSIL_ENABLE_TCL
#include "tcl.h"
1149
1150
1151
1152
1153
1154
1155
1156
1157



1158
1159
1160
1161
1162
1163
1164
      }
      zDir[i] = '/';
      zRepo = &zDir[i];
    }
    if( stat(zRepo, &sStat)!=0 ){
      fossil_fatal("cannot stat() repository: %s", zRepo);
    }
    setgid(sStat.st_gid);
    setuid(sStat.st_uid);



    if( g.db!=0 ){
      db_close(1);
      db_open_repository(zRepo);
    }
  }
#endif
  return zRepo;







|
|
>
>
>







1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
      }
      zDir[i] = '/';
      zRepo = &zDir[i];
    }
    if( stat(zRepo, &sStat)!=0 ){
      fossil_fatal("cannot stat() repository: %s", zRepo);
    }
    i = setgid(sStat.st_gid);
    i = i || setuid(sStat.st_uid);
    if(i){
      fossil_fatal("setgid/uid() failed with errno %d", errno);
    }
    if( g.db!=0 ){
      db_close(1);
      db_open_repository(zRepo);
    }
  }
#endif
  return zRepo;