[libc-commits] [libc] [libc] implement pathconf/fpathconf (PR #87165)

Schrodinger ZHU Yifan via libc-commits libc-commits at lists.llvm.org
Mon May 13 07:00:50 PDT 2024


================
@@ -101,18 +101,19 @@ static long fpathconfig(const struct fstatfs &s, int name) {
   case _PC_REC_MAX_XFER_SIZE:
   case _PC_SYMLINK_MAX:
   case _PC_SYNC_IO:
+    return -1;
+
   default:
+    errno = EINVAL;
     return -1;
   }
 }
 
 LLVM_LIBC_FUNCTION(long, fpathconf, (int fd, int name)) {
   struct fstatfs sb;
-  cpp::optional<LinuxStatFs> result = linux_fstatfs(fd);
-  if (!result.has_value()) {
-    return -1;
-  }
-  return fpathconfig(sb, name);
+  if (cpp::optional<LinuxStatFs> result = linux_fstatfs(fd))
+    return fpathconfig(sb, name);
----------------
SchrodingerZhu wrote:

Sorry that for requesting more for this PR. Looking forward to your patch!

https://github.com/llvm/llvm-project/pull/87165


More information about the libc-commits mailing list