Re: [PATCH] Cleanup: snprintf() always NUL-terminates: depend on it

2015-01-12 Thread Aleksandr P
> len = snprintf(fname, 99, "%s", buf); > - fname[len-1] = '\0'; > I just deleted that "really, really" NUL-termination line because > it was based on a misunderstanding of snprintf()'s postcondition. Are you sure this code can be simple deleted? It does not only terminate the string but

Re: [PATCH] Cleanup: snprintf() always NUL-terminates: depend on it

2015-01-12 Thread Aleksandr P
len = snprintf(fname, 99, %s, buf); - fname[len-1] = '\0'; I just deleted that really, really NUL-termination line because it was based on a misunderstanding of snprintf()'s postcondition. Are you sure this code can be simple deleted? It does not only terminate the string but deletes the