Date: Thu, 11 Nov 2010 12:06:31 GMT From: Martin Simmons <martin@lispworks.com> To: mark@exonetric.com Cc: freebsd-fs@freebsd.org Subject: Re: ZFS and pathconf(_PC_NO_TRUNC) Message-ID: <201011111206.oABC6VYG027663@higson.cam.lispworks.com> In-Reply-To: <871369D9-7D63-4CE0-BB87-B8C46A62B271@exonetric.com> (message from Mark Blackman on Wed, 10 Nov 2010 22:28:27 %2B0000) References: <871369D9-7D63-4CE0-BB87-B8C46A62B271@exonetric.com>
next in thread | previous in thread | raw e-mail | index | archive | help
>>>>> On Wed, 10 Nov 2010 22:28:27 +0000, Mark Blackman said:
>
> I note that when testing the pathconf(2) NO_TRUNC property
> on a ZFS filesystem, I get a ENOENT, "No such file or directory".
>
> I'm not sure if this qualifies as correct behaviour, but thought
> a learned soul on this list could enlighten me.
>
> I've attached the C snippet I used for testing.
>
> #include <unistd.h>
> #include <stdlib.h>
> #include <stdio.h>
> #include <string.h>
> #include <errno.h>
>
> int main(int argc, char *argv[]){
> int result;
>
> result=pathconf(argv[1], _PC_NO_TRUNC);
> printf("for %s: no_trunc is %d\n",argv[1],result);
> if (result<0)
> perror(NULL);
> 1;
> }
Your call to printf is clobbering the real errno, which is EINVAL. That is an
allowed value according to the pathconf man page:
[EINVAL] The implementation does not support an association of
the variable name with the associated file.
So it is correct, but maybe not useful.
__Martin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011111206.oABC6VYG027663>
