On Thu, Oct 27, 2005 at 10:46:04AM -0700, John N. Brahy wrote:
> strlcat(mailbox, MAILSPOOLHOME, sizeof(mailbox));

In addition to the other replies (pointer vs. array), the return value
should be checked to avoid truncation. You don't want errors like this:

$ cat > foo.c <<'EOD'
#include <stdio.h>
#include <string.h>

int main(int argc, char *argv[]) {
        char s[25] = "Message: ";

        argc--;
        argv++;

        while (argc--) {
                strlcat(s, *argv++, sizeof(s));
        }
        puts(s);

        return 0;
}
EOD
$ cc -o foo foo.c
$ ./foo "I like your bumerang collection."
Message: I like your bum

[Spelling errors intended for this contrived example]

Ciao,
        Kili

Reply via email to