Hi,

currently, querying (f)pathconf() for _PC_PATH_MAX return -1 and sets 
errno = EINVAL. At least to my reading of pathconf() in POSIX, when a 
variable has no limit pathconf() for it should return -1 and not change 
errno. For example:
  $ getconf PATH_MAX .
  getconf: pathconf: .: Invalid argument
fpathconf() just queries the translator which handles the specified 
path, so the fix I thought about is to make the io_pathconf() reply in 
libdiskfs handle _PC_PATH_MAX too among the other cases of "set -1 and 
return 0".

With the applied path, I correctly get:
  $ getconf PATH_MAX .
  undefined

-- 
Pino Toscano
From f7835870d3a2f0447faa31f1159a50a63e26eac9 Mon Sep 17 00:00:00 2001
From: Pino Toscano <toscano.p...@tiscali.it>
Date: Tue, 18 Oct 2011 23:47:51 +0200
Subject: [PATCH] libdiskfs: handle _PC_PATH_MAX in pathconf

Explicitly return -1 also for _PC_PATH_MAX to indicate there is no
limit for it, otherwise EINVAL is returned for it.

* libdiskfs/io-pathconf.c (diskfs_S_io_pathconf): Handle _PC_PATH_MAX
too.
---
 libdiskfs/io-pathconf.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/libdiskfs/io-pathconf.c b/libdiskfs/io-pathconf.c
index b851f9b..38e277c 100644
--- a/libdiskfs/io-pathconf.c
+++ b/libdiskfs/io-pathconf.c
@@ -41,6 +41,7 @@ diskfs_S_io_pathconf (struct protid *cred,
     case _PC_PIPE_BUF:
     case _PC_VDISABLE:
     case _PC_SOCK_MAXBUF:
+    case _PC_PATH_MAX:
       *value = -1;
       break;
 
-- 
1.7.6.3

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to