util  Diff

Differences From Artifact [c67b168cf4]:

To Artifact [afa1600fae]:


34
35
36
37
38
39
40










41
42
43
44
45
46
47
...
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
 * the command  “xpriv -a”  instead of the  user’s normal
 * shell. the -a flag instructs xpriv to get the terminal
 * window’s  ID from  the $WINDOWID  environment variable
 * which urxvt  sets. after this, a  ssh-agent process is
 * launched. spriv waits until it has opened a socket and
 * then runs ssh-add without parameters to add the user's
 * default keys to the session.










 *
 * xpriv  does  its  best   to  clean  up  after  itself,
 * killing all sensitive processes and their children and
 * removing the  shmem segment  when it  is no  longer in
 * use, even if exits somewhat abnormally. if you have to
 * kill -9 xpriv  at any point tho, you can  make it work
 * again (on linux) with
................................................................................
			case 'w': init_weak = true; break;
			default: return bad(fail_opt);
		}
		if(opt[1] != 0) { ++opt; goto read_opt; }
	}

	size_t nsz;
	const char* basename, *p;
	for (p = argv[0]; *p!=0; ++p) {
		if(*p == '/') basename = p + 1;
	}
	nsz = p - basename;
	char shid[nsz + sizeof shmem_prefix + 0];
	strncpy(shid,shmem_prefix,sizeof shmem_prefix);
	strncpy(shid + sizeof shmem_prefix - 1, basename, nsz);







>
>
>
>
>
>
>
>
>
>







 







|







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

	size_t nsz;
	const char* basename = argv[0], *p;
	for (p = argv[0]; *p!=0; ++p) {
		if(*p == '/') basename = p + 1;
	}
	nsz = p - basename;
	char shid[nsz + sizeof shmem_prefix + 0];
	strncpy(shid,shmem_prefix,sizeof shmem_prefix);
	strncpy(shid + sizeof shmem_prefix - 1, basename, nsz);