Changeset 3321 for neercs/trunk


Ignore:
Timestamp:
Nov 10, 2008, 11:17:18 PM (12 years ago)
Author:
Pascal Terjan
Message:
  • Don't create /dev/null when it is not there, some people may run neercs as root
  • Display error when fork or opening /dev/null fails
File:
1 edited

Legend:

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

    r2995 r3321  
    427427    if(pid < 0)
    428428    {
    429         fprintf(stderr, "Failed to create child process\n");
    430         return 1;
     429        perror("Failed to create child process");
     430        return -1;
    431431    }
    432432    if(pid == 0)
     
    436436        close(1);
    437437        close(2);
    438         fd = open("/dev/null", O_RDWR|O_CREAT, S_IRUSR|S_IWUSR);
     438        fd = open("/dev/null", O_RDWR, 0);
     439        if(fd < 0)
     440        {
     441            perror("Failed to open /dev/null");
     442            return -2;
     443        }
    439444        dup2(fd, 0);
    440445#ifndef DEBUG
     
    464469    screen_list->dp = caca_create_display(screen_list->cv);
    465470    if(!screen_list->dp)
    466         return 1;
     471        return -3;
    467472    caca_set_cursor(screen_list->dp, 1);
    468473
Note: See TracChangeset for help on using the changeset viewer.