File: chinitdir.hack

package info (click to toggle)
ircd 2.10.02-1
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 2,228 kB
  • ctags: 2,087
  • sloc: ansic: 29,122; makefile: 664; sh: 307; perl: 18
file content (47 lines) | stat: -rw-r--r-- 895 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
*** ircd.c.orig	Thu Jan 22 07:38:28 1998
--- ircd.c	Thu Jan 22 07:39:42 1998
***************
*** 46,51 ****
--- 46,54 ----
  #ifdef USE_SYSLOG
  #include <syslog.h>
  #endif
+ #if 1
+ #include <pwd.h> 
+ #endif
  #ifdef	CHROOTDIR
  #include <resolv.h> 
  #endif
***************
*** 565,570 ****
--- 568,576 ----
  #if defined(HAVE_SETRLIMIT) && defined(RLIMIT_CORE)
    struct rlimit corelim;
  #endif
+ #if 1
+   struct passwd *pass;
+ #endif /*CHINITDIR */
  
    uid = getuid();
    euid = geteuid();
***************
*** 574,579 ****
--- 580,597 ----
    moncontrol(1);
    signal(SIGUSR1, s_monitor);
  #endif
+ 
+ #if 1
+   if (pass = getpwuid (getuid()))
+     {
+       if (chdir(pass->pw_dir))
+ 	{
+ 	  fprintf(stderr, "ERROR:  Cannot chdir to home dir %s\n", pass->pw_dir);
+ 	  exit(5);
+ 	}
+     }
+   endpwent();
+ #endif /*CHINITDIR */
  
  #ifdef	CHROOTDIR
    if (chdir(dpath))