Changeset 1404

Show
Ignore:
Timestamp:
10/06/07 21:34:49 (11 months ago)
Author:
till
Message:

honeytrap

  • process id in pid file got truncated, fixed
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • honeytrap/trunk/src/ctrl.c

    r1355 r1404  
    167167/* write master process id to pid file */ 
    168168int create_pid_file(void) { 
    169         char pid_str[5]; 
     169        char pid_str[6]; 
    170170 
    171171        if ((pidfile_fd = open(pidfile_name, O_EXCL | O_CREAT | O_NOCTTY | O_RDWR, 0640)) == -1) { 
     
    180180        master_pid = getpid(); 
    181181 
    182         bzero(pid_str, 5); 
    183         snprintf(pid_str, 5,"%d\n", master_pid); 
    184         if (!(write(pidfile_fd, pid_str, strlen(pid_str)))) { 
     182        bzero(pid_str, 6); 
     183        snprintf(pid_str, 6,"%d", master_pid); 
     184        if (write(pidfile_fd, pid_str, strlen(pid_str)) != strlen(pid_str)) { 
    185185                logmsg(LOG_ERR, 1, "Error - Unable to write pid file: %m.\n"); 
    186186                return(0);