Ignore:
Timestamp:
Nov 4, 2007, 3:16:40 AM (17 years ago)
Author:
Bruno Cornec
Message:

Update to busybox 1.7.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.5/mindi-busybox/libbb/safe_strncpy.c

    r821 r1765  
    88 */
    99
    10 #include <string.h>
    1110#include "libbb.h"
    12 
    13 
    1411
    1512/* Like strncpy but make sure the resulting string is always 0 terminated. */
    1613char * safe_strncpy(char *dst, const char *src, size_t size)
    1714{
    18     dst[size-1] = '\0';
    19     return strncpy(dst, src, size-1);
     15    if (!size) return dst;
     16    dst[--size] = '\0';
     17    return strncpy(dst, src, size);
    2018}
Note: See TracChangeset for help on using the changeset viewer.