src/dqsd/gow.cpp
/* _JoinPath requires that any buffer argument passed to it has at
       least MAXPATHLEN + 1 bytes allocated.  If this requirement is met,
       it guarantees that it will never overflow the buffer.  If stuff
       is too long, buffer will contain a truncated copy of stuff.
    */
_JoinPath requires that any buffer argument passed to it has at
least MAXPATHLEN + 1 bytes allocated.  If this requirement is met,
it guarantees that it will never overflow the buffer.  If stuff
is too long, buffer will contain a truncated copy of stuff.
_JoinPath requires that any buffer argument passed to it has at least MAXPATHLEN + 1 bytes allocated . If this requirement is met it guarantees that it will never overflow the buffer . If stuff is too long buffer will contain a truncated copy of stuff .
static void
    _JoinPath(char *buffer, char *stuff)
    {
        size_t n, k;
        if (stuff[0] == SEP)
            n = 0;
        else {
            n = strlen(buffer);
            if (n > 0 && buffer[n-1] != SEP && n < MAXPATHLEN)
                buffer[n++] = SEP;
        }
        k = strlen(stuff);
        if (n + k > MAXPATHLEN)
            k = MAXPATHLEN - n;
        strncpy(buffer+n, stuff, k);
        buffer[n+k] = '\0';
    }
static void _JoinPath ( char * buffer , char * stuff ) { size_t n , k ; if ( stuff [ 0 ] == SEP ) n = 0 ; else { n = strlen ( buffer ) ; if ( n > 0 && buffer [ n - 1 ] != SEP && n < MAXPATHLEN ) buffer [ n ++ ] = SEP ; } k = strlen ( stuff ) ; if ( n + k > MAXPATHLEN ) k = MAXPATHLEN - n ; strncpy ( buffer + n , stuff , k ) ; buffer [ n + k ] = ' \0 ' ; }
_JoinPath requires that any buffer argument passed to it has at
least MAXPATHLEN + 1 bytes allocated.
_JoinPath requires that any buffer argument passed to it has at least MAXPATHLEN + 1 bytes allocated .