Re: [patch] File locking



   +            char lockstr[300];
   +            char hostname[256];
   +            /* Create the locking string, format is 
   +             * hostname:pid */
   +            gethostname(hostname, 255);
   +            snprintf(lockstr, 300, "%s:%d", hostname, getpid());

No, array[constant], please.  Use dynamically allocated strings
instead.  Also, getpid returns a pid_t, not an int, so it does not
match "%d".

Thanks,

Morten



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]