Ignore:
Timestamp:
Jun 15, 2008, 7:17:36 PM (14 years ago)
Author:
Pascal Terjan
Message:
  • Remove one of the reads of /proc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • neercs/trunk/src/grab.c

    r2428 r2429  
    256256}
    257257
    258 int grab_process(pid_t pid, int ptyfd)
     258int grab_process(pid_t pid, char *ptyname, int ptyfd)
    259259{
    260260    struct termios t;
    261261    int i, fd = 0, mode, ret;
    262     char tty[1024];
    263262    char fdstr[1024];
    264263    struct stat stat_buf;
    265264
    266     snprintf(fdstr, sizeof(fdstr), "/proc/%d/fd/%d", getpid(), ptyfd);
    267     if ((i = readlink(fdstr, tty, sizeof(tty)-1)) == -1) {
    268         fprintf(stderr, "readlink failed\n");
    269         return -1;
    270     }
    271     tty[i] = 0;
    272     debug("Our pty is %s", tty);
     265    debug("pty is %s", ptyname);
    273266
    274267    if(ptrace(PTRACE_ATTACH, pid, 0, 0) < 0)
     
    304297            fprintf(stderr, "do_close %s\n", strerror(ret));
    305298        }
    306         if((ret = do_open(pid, tty, mode, &fd)))
     299        if((ret = do_open(pid, ptyname, mode, &fd)))
    307300        {
    308301            fprintf(stderr, "do_open %s\n", strerror(ret));
Note: See TracChangeset for help on using the changeset viewer.