git://git.exim.org
/
exim.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d8b7064
)
Store the initial working directory, expand $initial_cwd. Bug 1805
author
Heiko Schlittermann (HS12-RIPE)
<hs@schlittermann.de>
Wed, 9 Mar 2016 10:13:42 +0000
(11:13 +0100)
committer
Heiko Schlittermann (HS12-RIPE)
<hs@schlittermann.de>
Wed, 9 Mar 2016 10:46:21 +0000
(11:46 +0100)
doc/doc-docbook/spec.xfpt
patch
|
blob
|
history
doc/doc-txt/NewStuff
patch
|
blob
|
history
src/src/exim.c
patch
|
blob
|
history
src/src/expand.c
patch
|
blob
|
history
src/src/globals.c
patch
|
blob
|
history
src/src/globals.h
patch
|
blob
|
history
diff --git
a/doc/doc-docbook/spec.xfpt
b/doc/doc-docbook/spec.xfpt
index fdb318b89888610d7203797e68e6a0a107ace6ec..cf5c30c6bac1c1dfc53922df8b9d99b326bfdd72 100644
(file)
--- a/
doc/doc-docbook/spec.xfpt
+++ b/
doc/doc-docbook/spec.xfpt
@@
-11735,6
+11735,12
@@
See &$host_lookup_deferred$&.
This variable is set to the remote host's TCP port whenever &$host$& is set
for an outbound connection.
This variable is set to the remote host's TCP port whenever &$host$& is set
for an outbound connection.
+.vitem &$initial_cwd$&
+.vindex "&$initial_cwd$&
+This variable contains the full path name of the initial working
+directory of the current Exim process. This may differ from the current
+working directory, as Exim changes this to "/" during early startup, and
+to &$spool_directory$& later.
.vitem &$inode$&
.vindex "&$inode$&"
.vitem &$inode$&
.vindex "&$inode$&"
diff --git
a/doc/doc-txt/NewStuff
b/doc/doc-txt/NewStuff
index 01bd0111e0b54daac3ed2e756afc0a202069ab03..80c92a536193aa9724dafc9e7df372a37f51e6aa 100644
(file)
--- a/
doc/doc-txt/NewStuff
+++ b/
doc/doc-txt/NewStuff
@@
-35,6
+35,8
@@
Version 4.87
avoid oversize bodies in bounces. The dafault value matches RFC
limits.
avoid oversize bodies in bounces. The dafault value matches RFC
limits.
+ 9. New $initial_cwd expansion variable.
+
Version 4.86
------------
Version 4.86
------------
diff --git
a/src/src/exim.c
b/src/src/exim.c
index 02fda675621a4182a32c38b1313c6dd801f623f6..574e7804ba37adb9564bd99f1e045d82c3716410 100644
(file)
--- a/
src/src/exim.c
+++ b/
src/src/exim.c
@@
-3747,6
+3747,9
@@
NOTE: immediatly after opening the configuration file we change the working
directory to "/"! Later we change to $spool_directory. We do it there, because
during readconf_main() some expansion takes place already. */
directory to "/"! Later we change to $spool_directory. We do it there, because
during readconf_main() some expansion takes place already. */
+/* Store the initial cwd before we change directories */
+initial_cwd = getcwd(NULL, 0);
+
readconf_main();
/* Now in directory "/" */
readconf_main();
/* Now in directory "/" */
@@
-4042,9
+4045,10
@@
if (((debug_selector & D_any) != 0 || LOGGING(arguments))
{
int i;
uschar *p = big_buffer;
{
int i;
uschar *p = big_buffer;
- char * dummy;
Ustrcpy(p, "cwd= (failed)");
Ustrcpy(p, "cwd= (failed)");
- dummy = /* quieten compiler */ getcwd(CS p+4, big_buffer_size - 4);
+
+ Ustrncpy(p + 4, initial_cwd, big_buffer_size-5);
+
while (*p) p++;
(void)string_format(p, big_buffer_size - (p - big_buffer), " %d args:", argc);
while (*p) p++;
while (*p) p++;
(void)string_format(p, big_buffer_size - (p - big_buffer), " %d args:", argc);
while (*p) p++;
diff --git
a/src/src/expand.c
b/src/src/expand.c
index cc22e65fbd2cce754132523611ee3aa1361a47aa..99d2ffc00052bf20f908f1ee271f78fd869ec52f 100644
(file)
--- a/
src/src/expand.c
+++ b/
src/src/expand.c
@@
-543,6
+543,7
@@
static var_entry var_table[] = {
{ "host_lookup_deferred",vtype_int, &host_lookup_deferred },
{ "host_lookup_failed", vtype_int, &host_lookup_failed },
{ "host_port", vtype_int, &deliver_host_port },
{ "host_lookup_deferred",vtype_int, &host_lookup_deferred },
{ "host_lookup_failed", vtype_int, &host_lookup_failed },
{ "host_port", vtype_int, &deliver_host_port },
+ { "initial_cwd", vtype_stringptr, &initial_cwd },
{ "inode", vtype_ino, &deliver_inode },
{ "interface_address", vtype_stringptr, &interface_address },
{ "interface_port", vtype_int, &interface_port },
{ "inode", vtype_ino, &deliver_inode },
{ "interface_address", vtype_stringptr, &interface_address },
{ "interface_port", vtype_int, &interface_port },
diff --git
a/src/src/globals.c
b/src/src/globals.c
index e5bbb8340bdd2aea41c3dc3af63186d1c4d04080..da6e4b31d42f02517298dcdb3d6e84489f61a54d 100644
(file)
--- a/
src/src/globals.c
+++ b/
src/src/globals.c
@@
-797,6
+797,7
@@
BOOL ignore_fromline_local = FALSE;
uschar *ignore_fromline_hosts = NULL;
BOOL inetd_wait_mode = FALSE;
int inetd_wait_timeout = -1;
uschar *ignore_fromline_hosts = NULL;
BOOL inetd_wait_mode = FALSE;
int inetd_wait_timeout = -1;
+uschar *initial_cwd = NULL;
uschar *interface_address = NULL;
int interface_port = -1;
BOOL is_inetd = FALSE;
uschar *interface_address = NULL;
int interface_port = -1;
BOOL is_inetd = FALSE;
diff --git
a/src/src/globals.h
b/src/src/globals.h
index 1919d8c1fa17272157779e4f19ee50937ea1ebd9..b7f9c348998ab42e1555399fef32919b8a951420 100644
(file)
--- a/
src/src/globals.h
+++ b/
src/src/globals.h
@@
-512,6
+512,7
@@
extern BOOL ignore_fromline_local; /* Local SMTP ignore fromline */
extern uschar *ignore_fromline_hosts; /* Hosts permitted to send "From " */
extern BOOL inetd_wait_mode; /* Whether running in inetd wait mode */
extern int inetd_wait_timeout; /* Timeout for inetd wait mode */
extern uschar *ignore_fromline_hosts; /* Hosts permitted to send "From " */
extern BOOL inetd_wait_mode; /* Whether running in inetd wait mode */
extern int inetd_wait_timeout; /* Timeout for inetd wait mode */
+extern uschar *initial_cwd; /* The directory we where in at startup */
extern BOOL is_inetd; /* True for inetd calls */
extern uschar *iterate_item; /* Item from iterate list */
extern BOOL is_inetd; /* True for inetd calls */
extern uschar *iterate_item; /* Item from iterate list */