Re: [zfs] Mounting from (...) failed with error 19

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Garrett Cooper
Date: Wednesday, October 20, 2010 - 1:39 pm

On Wed, Oct 20, 2010 at 12:45 PM, Peter Jeremy <peterjeremy@acm.org> wrote:

I'd say that strcmp is perfectly fine because zfs is a 3 character (4
if you count NUL) string. The comparison logic is dang near the same:

/*
 * Compare strings.
 */
int
strcmp(const char *s1, const char *s2)
{
        while (*s1 == *s2++)
                if (*s1++ == '\0')
                        return (0);
        return (*(const unsigned char *)s1 - *(const unsigned char *)(s2 - 1));
}

int
strncmp(const char *s1, const char *s2, size_t n)
{

        if (n == 0)
                return (0);
        do {
                if (*s1 != *s2++)
                        return (*(const unsigned char *)s1 -
                                *(const unsigned char *)(s2 - 1));
                if (*s1++ == '\0')
                        break;
        } while (--n != 0);
        return (0);
}

Weird how n == 0 with strcmp returns 0...

-Garrett
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[zfs] Mounting from (...) failed with error 19, Xin LI, (Mon Oct 18, 4:50 pm)
Re: [zfs] Mounting from (...) failed with error 19, Andrey V. Elsukov, (Mon Oct 18, 10:03 pm)
Re: [zfs] Mounting from (...) failed with error 19, Andrey V. Elsukov, (Tue Oct 19, 7:55 am)
Re: [zfs] Mounting from (...) failed with error 19, Marcel Moolenaar, (Tue Oct 19, 8:43 am)
Re: [zfs] Mounting from (...) failed with error 19, Marcel Moolenaar, (Tue Oct 19, 8:49 am)
Re: [zfs] Mounting from (...) failed with error 19, Andrey V. Elsukov, (Tue Oct 19, 9:24 am)
Re: [zfs] Mounting from (...) failed with error 19, KOT MATPOCKuH, (Tue Oct 19, 11:16 am)
Re: [zfs] Mounting from (...) failed with error 19, KOT MATPOCKuH, (Tue Oct 19, 12:50 pm)
Re: [zfs] Mounting from (...) failed with error 19, Marcel Moolenaar, (Tue Oct 19, 3:33 pm)
Re: [zfs] Mounting from (...) failed with error 19, Andrey V. Elsukov, (Tue Oct 19, 9:38 pm)
Re: [zfs] Mounting from (...) failed with error 19, KOT MATPOCKuH, (Tue Oct 19, 11:50 pm)
Re: [zfs] Mounting from (...) failed with error 19, Andrey V. Elsukov, (Wed Oct 20, 12:21 am)
Re: [zfs] Mounting from (...) failed with error 19, Marcel Moolenaar, (Wed Oct 20, 9:23 am)
Re: [zfs] Mounting from (...) failed with error 19, Peter Jeremy, (Wed Oct 20, 12:45 pm)
Re: [zfs] Mounting from (...) failed with error 19, Garrett Cooper, (Wed Oct 20, 1:39 pm)
Re: [zfs] Mounting from (...) failed with error 19, Garrett Cooper, (Wed Oct 20, 1:40 pm)
Re: [zfs] Mounting from (...) failed with error 19, Matthew Fleming, (Wed Oct 20, 3:18 pm)
Re: [zfs] Mounting from (...) failed with error 19, Garrett Cooper, (Wed Oct 20, 3:46 pm)