--- rxvt-unicode/src/rxvtc.C 2004/12/20 16:44:31 1.14 +++ rxvt-unicode/src/rxvtc.C 2005/11/28 19:35:04 1.16 @@ -65,8 +65,6 @@ main (int argc, const char *const *argv) { client c; - char buf[PATH_MAX]; - { sigset_t ss; @@ -76,11 +74,20 @@ } c.send ("NEW"); + // instead of getcwd we could opendir (".") and pass the fd for fchdir *g* - c.send ("CWD"), c.send (getcwd (buf, sizeof (buf))); + char cwd[PATH_MAX]; + + if (!getcwd (cwd, sizeof (cwd))) + { + perror ("unable to determine current working directory"); + exit (EXIT_FAILURE); + } + + c.send ("CWD"), c.send (cwd); - for (char **var = environ; *environ; environ++) - c.send ("ENV"), c.send (*environ); + for (char **var = environ; *var; var++) + c.send ("ENV"), c.send (*var); const char *base = strrchr (argv[0], '/'); base = base ? base + 1 : argv[0];