hrev49487 adds 1 changeset to branch 'master'
old head: b4665f9a5920f7f3d3795d011afd5b852000a9f4
new head: 6306a2634bf096c2ebbe4a772538703350234d28
overview:
http://cgit.haiku-os.org/haiku/log/?qt=range&q=6306a2634bf0+%5Eb4665f9a5920
----------------------------------------------------------------------------
6306a2634bf0: launch_daemon: Set working directory to user's directory.
* This fixes #12257.
[ Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> ]
----------------------------------------------------------------------------
Revision: hrev49487
Commit: 6306a2634bf096c2ebbe4a772538703350234d28
URL: http://cgit.haiku-os.org/haiku/commit/?id=6306a2634bf0
Author: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date: Thu Jul 30 20:54:39 2015 UTC
Ticket: https://dev.haiku-os.org/ticket/12257
----------------------------------------------------------------------------
1 file changed, 10 insertions(+), 3 deletions(-)
src/servers/launch/LaunchDaemon.cpp | 13 ++++++++++---
----------------------------------------------------------------------------
diff --git a/src/servers/launch/LaunchDaemon.cpp
b/src/servers/launch/LaunchDaemon.cpp
index efaa328..93fbaac 100644
--- a/src/servers/launch/LaunchDaemon.cpp
+++ b/src/servers/launch/LaunchDaemon.cpp
@@ -1215,9 +1215,16 @@ LaunchDaemon::_StartSession(const char* login)
if (setuid(user) != 0)
exit(EXIT_FAILURE);
- BString home="HOME=\"";
- home << passwd->pw_dir << "\"";
- putenv(home.String());
+ if (passwd->pw_dir != NULL && passwd->pw_dir[0] != '\0') {
+ BString home="HOME=\"";
+ home << passwd->pw_dir << "\"";
+ putenv(home.String());
+
+ if (chdir(passwd->pw_dir) != 0) {
+ debug_printf("Could not switch to home dir %s:
%s\n",
+ passwd->pw_dir, strerror(errno));
+ }
+ }
// TODO: This leaks the parent application
be_app = NULL;