memchr() strangeness
Gabor Kovesdan
gabor at FreeBSD.org
Fri Sep 4 17:59:05 UTC 2009
Alfred Perlstein escribió:
> Moved to -hackers.
>
Thanks, this was my original intention.
> Gabor, can you please make a smaller program to exhibit this behavior?
> (not just the error line)
>
> I will be glad to help out.
>
After reading your mail, I've made a small program:
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int
main(int argc, char *argv[])
{
bool foo;
foo = memchr(argv[1], '\0', strlen(argv[1]));
if (foo)
fprintf(stderr, "Ooooops!\n");
}
And it works correctly, so actually grep fails somewhere else but it's
very strange why it behaves differently jailed (or chrooted). Once
submitted it for a portbuild test because it had been working correctly
for me on a production system and then it failed on the cluster because
the package build run jailed. And then I created a jail and in fact I
could reproduce this but only in the jail.
Regards,
--
Gabor Kovesdan
FreeBSD Volunteer
EMAIL: gabor at FreeBSD.org .:|:. gabor at kovesdan.org
WEB: http://people.FreeBSD.org/~gabor .:|:. http://kovesdan.org
More information about the freebsd-hackers
mailing list