Differences From
Artifact [c67b168cf4]:
34 34 * the command “xpriv -a” instead of the user’s normal
35 35 * shell. the -a flag instructs xpriv to get the terminal
36 36 * window’s ID from the $WINDOWID environment variable
37 37 * which urxvt sets. after this, a ssh-agent process is
38 38 * launched. spriv waits until it has opened a socket and
39 39 * then runs ssh-add without parameters to add the user's
40 40 * default keys to the session.
41 + *
42 + * after a success key-add has been confirmed, xpriv
43 + * marks the window as “vital” by setting the X property
44 + * “_k_vital” on the window. if the login fails or does
45 + * not complete, safekill.c will still terminate it at
46 + * any time. the vital flag is removed as soon as the
47 + * controlling shell terminates; it does *not* remain for
48 + * the lifetime of the window, so a "temporary" session
49 + * can be created in the current terminal by calling
50 + * `xpriv -a` directly.
41 51 *
42 52 * xpriv does its best to clean up after itself,
43 53 * killing all sensitive processes and their children and
44 54 * removing the shmem segment when it is no longer in
45 55 * use, even if exits somewhat abnormally. if you have to
46 56 * kill -9 xpriv at any point tho, you can make it work
47 57 * again (on linux) with
................................................................................
304 314 case 'w': init_weak = true; break;
305 315 default: return bad(fail_opt);
306 316 }
307 317 if(opt[1] != 0) { ++opt; goto read_opt; }
308 318 }
309 319
310 320 size_t nsz;
311 - const char* basename, *p;
321 + const char* basename = argv[0], *p;
312 322 for (p = argv[0]; *p!=0; ++p) {
313 323 if(*p == '/') basename = p + 1;
314 324 }
315 325 nsz = p - basename;
316 326 char shid[nsz + sizeof shmem_prefix + 0];
317 327 strncpy(shid,shmem_prefix,sizeof shmem_prefix);
318 328 strncpy(shid + sizeof shmem_prefix - 1, basename, nsz);