From: Martin H. <ma...@he...> - 2006-09-13 19:19:09
|
Hi everybody, Michael Reinelt wrote: >>> Did you already commit? Did I give you CVS write access? >> Nope, doesn't seem like I have CVS write access. (I'm also not listed on the >> SF.net developer list for lcd4linux) > Oh.. did you ever tell me your SF account name? I'll add you to the > devel group. > >>>> + strncpy(thread_argv[0],name,strlen(thread_argv[0])); > >> Thats why I used "strNcpy" with the original argv[0] length as limit. >> It won't overwrite data it shouldn't, but will truncate the threads name if >> its longer than the original binary name. > > silly me... I always mix up src and dst with strcpy :-) I didn't look at the context - but the thing that always bothered me with (and kept me from using strncpy) is that if src is longer than dest, the result is that dest is not terminated by \0 - unless I read the manpage incorrectly: char *strncpy(char *restrict s1, const char *restrict s2, size_t n); The strncpy() function shall copy not more than n bytes (bytes that follow a null byte are not copied) from the array pointed to by s2 to the array pointed to by s1. (...) If there is no null byte in the first n bytes of the array pointed to by s2, the result is not null-terminated Did I miss something? Martin |