ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvtd.C
(Generate patch)

Comparing rxvt-unicode/src/rxvtd.C (file contents):
Revision 1.44 by root, Tue Feb 19 13:37:17 2008 UTC vs.
Revision 1.46 by root, Sun Jun 15 13:54:15 2008 UTC

172 172
173 if (!strcmp (tok, "END")) 173 if (!strcmp (tok, "END"))
174 break; 174 break;
175 else if (!strcmp (tok, "ENV") && recv (tok)) 175 else if (!strcmp (tok, "ENV") && recv (tok))
176 envv->push_back (strdup (tok)); 176 envv->push_back (strdup (tok));
177 else if (!strcmp (tok, "CWD") && recv (tok))
178 {
179 if (chdir (tok))
180 {
181 delete envv;
182 delete argv;
183 return err ("unable to change to working directory to '%s', aborting: %s.\n",
184 (char *)tok, strerror (errno));
185 }
186 }
187 else if (!strcmp (tok, "ARG") && recv (tok)) 177 else if (!strcmp (tok, "ARG") && recv (tok))
188 argv->push_back (strdup (tok)); 178 argv->push_back (strdup (tok));
189 else 179 else
190 return err ("protocol error: unexpected NEW token.\n"); 180 return err ("protocol error: unexpected NEW token.\n");
191 } 181 }
209 success = false; 199 success = false;
210 } 200 }
211 201
212 term->log_hook = 0; 202 term->log_hook = 0;
213 203
214 chdir ("/"); 204 chdir ("/"); // init might change to different working directory
215 205
216 if (!success) 206 if (!success)
217 term->destroy (); 207 term->destroy ();
218 208
219 send ("END"); send (success ? 1 : 0); 209 send ("END"); send (success ? 1 : 0);
246 rxvt_log ("%s: unknown option '%s', aborting.\n", argv [0], argv [i]); 236 rxvt_log ("%s: unknown option '%s', aborting.\n", argv [0], argv [i]);
247 return EXIT_FAILURE; 237 return EXIT_FAILURE;
248 } 238 }
249 } 239 }
250 240
241 // optionally open display and never release it.
251 if (opt_opendisplay) 242 if (opt_opendisplay)
252 displays.get (getenv ("DISPLAY")); // open display and never release it 243 if (const char *dpy = getenv ("DISPLAY"))
244 displays.get (dpy ? dpy : ":0"); // move string logic into rxvt_display maybe?
253 245
254 char *sockname = rxvt_connection::unix_sockname (); 246 char *sockname = rxvt_connection::unix_sockname ();
255 unix_listener l (sockname); 247 unix_listener l (sockname);
256 248
257 chdir ("/"); 249 chdir ("/");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines