xrwho, X11, SIGSEGV
xrwhoはX11版のrwhoで,現在ログイン中のユーザをホストごとに一覧表示します.
規模の大きなサイトで,頻繁にログイン/ログアウトが繰り返されるとSegmentation Violationで落ちる場合があるバグを修正します.
xrwho-1.1p1.patch (1997/11/06)
Only in xrwho.new: Makefile
diff -rc xrwho/xrwho.c xrwho.new/xrwho.c
*** xrwho/xrwho.c Thu Nov 6 19:13:12 1997
--- xrwho.new/xrwho.c Thu Nov 6 15:17:10 1997
***************
*** 545,552 ****
/* we haven't heard from host for too long so ignore it */
return 0;
}
! return (bytes - 60)/sizeof(struct whoent); /* number of whoent records */
}
--- 545,558 ----
/* we haven't heard from host for too long so ignore it */
return 0;
}
+ if (bytes < 0) {
+ #ifdef Debug
+ printf("xrwho: can't read %s/%s\n", RWHODIR, filename);
+ #endif
+ return 0;
+ }
! return ((bytes == 0) ? 0 : (bytes - 60)/sizeof(struct whoent)); /* number of whoent records */
}
***************
*** 637,642 ****
--- 643,651 ----
* scan through the utmp-style array for the host, updating idle times
* and checking whether users are still logged on
*/
+ #ifdef Debug
+ printf("# of users %d\n", n);
+ #endif
for (j = 0; j < n; j++) {
char *name;
int idle;
***************
*** 847,853 ****
--- 856,865 ----
if (hui->head != (user_t *)NULL)
printf("%s (%s), load: %g, wid: %ld\n", hui->host_name,
XtIsManaged(hui->title) ? "managed" : "not managed",
+ 0.01*hui->loadrange, hui->title);
+ /*
0.01*hui->loadav, hui->title);
+ */
for (k = hui->head; k != (user_t *)NULL; k = k->next) {
printf(" %s - idle %d %s (%d) wid: %ld\n", k->name, k->idle,
布目 淳@京都工芸繊維大学コンピュータシステム研究室
(nunome
kit.ac.jp)