Skip to content
Browse files

Fix detection of controlling tty on ARM.

dev_t is *not* necessarily the same as 'unsigned int', and pretending it is
breaks on ARM.
  • Loading branch information...
1 parent efb4fa7 commit 568c654aa437877027006aaf8e377ae0bea3329d @nelhage committed Apr 15, 2011
Showing with 3 additions and 1 deletion.
  1. +3 −1 attach.c
View
4 attach.c
@@ -58,18 +58,20 @@ struct proc_stat {
int parse_proc_stat(int statfd, struct proc_stat *out) {
char buf[1024];
int n;
+ unsigned dev;
lseek(statfd, 0, SEEK_SET);
if (read(statfd, buf, sizeof buf) < 0)
return errno;
n = sscanf(buf, "%d (%16[^)]) %c %d %d %d %u",
&out->pid, out->comm,
&out->state, &out->ppid, &out->sid,
- &out->pgid, (unsigned*)&out->ctty);
+ &out->pgid, &dev);
if (n == EOF)
return errno;
if (n != 7) {
return EINVAL;
}
+ out->ctty = dev;
return 0;
}

0 comments on commit 568c654

Please sign in to comment.
Something went wrong with that request. Please try again.