Skip to content

Commit

Permalink
Fix detection of controlling tty on ARM.
Browse files Browse the repository at this point in the history
dev_t is *not* necessarily the same as 'unsigned int', and pretending it is
breaks on ARM.
  • Loading branch information
nelhage committed Apr 15, 2011
1 parent efb4fa7 commit 568c654
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion attach.c
Expand Up @@ -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;
}

Expand Down

0 comments on commit 568c654

Please sign in to comment.