Ignore:
Timestamp:
Jun 23, 2008, 11:59:43 PM (13 years ago)
Author:
Pascal Terjan
Message:
  • Improve the speed of current attach (even if it will die)
  • Fix some messages
File:
1 edited

Legend:

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

    r2476 r2481  
    7979    close(2);
    8080
     81    fd = open("/dev/null", O_RDWR|O_CREAT, S_IRUSR|S_IWUSR);
     82    dup2(fd, 0);
     83    if(fd != 0)
     84        close(fd);
    8185    fd = open("/tmp/log.txt", O_RDWR|O_CREAT, S_IRUSR|S_IWUSR);
    82     dup2(fd, 0);
    8386    dup2(fd, 1);
    8487    dup2(fd, 2);
     
    195198int request_attach(char *socket_path)
    196199{
    197     int i;
    198200    int sock;
    199201    char fdstr[PATH_MAX], lnk[PATH_MAX];
     
    214216    if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0)
    215217    {
    216         perror("request_attach:connect");
     218        printf("Failed to connect to %s: %s\n", socket_path, strerror(errno));
    217219        return 1;
    218220    }
     
    221223
    222224    /* Send our environment */
    223     for(i=0; environ[i]; i++)
    224     {
    225         snprintf(buf, 4096, "ENV %s", environ[i]);
    226         write(sock, buf, strlen(buf));
    227     }
     225#define sendvar(var) if(getenv(var)) {snprintf(buf, 4096, "ENV %s=%s", var, getenv(var)); write(sock, buf, strlen(buf));}
     226    sendvar("DISPLAY")
     227    sendvar("CACA_DRIVER")
    228228
    229229    snprintf(fdstr, sizeof(fdstr), "/proc/%d/fd/0", getpid());
Note: See TracChangeset for help on using the changeset viewer.