# HG changeset patch # User Timo Sirainen # Date 1175112458 -10800 # Node ID 04404fd54cf6757d6eb57f912fd5a041d45ee00d # Parent ce1e1fab1e1d7dfba066f1b1dc4807d346bf17ba Fixed to work with chrooting diff -r ce1e1fab1e1d -r 04404fd54cf6 src/util/rawlog.c --- a/src/util/rawlog.c Wed Mar 28 23:06:37 2007 +0300 +++ b/src/util/rawlog.c Wed Mar 28 23:07:38 2007 +0300 @@ -267,13 +267,16 @@ static void rawlog_open(enum rawlog_flags flags) { - const char *home, *path; + const char *chroot, *home, *path; struct stat st; int sfd[2]; pid_t pid; + chroot = getenv("RESTRICT_CHROOT"); home = getenv("HOME"); - if (home == NULL) + if (chroot != NULL) + home = t_strconcat(chroot, home, NULL); + else if (home == NULL) home = "."; /* see if we want rawlog */ @@ -286,6 +289,11 @@ if (!S_ISDIR(st.st_mode)) return; + if (chroot != NULL) { + /* we'll chroot soon. skip over the chroot in the path. */ + path += strlen(chroot); + } + if (socketpair(AF_UNIX, SOCK_STREAM, 0, sfd) < 0) i_fatal("socketpair() failed: %m");