From c94f6b64c349d4baea94f9d8951b54fa51c6db44 Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Sat, 14 Jan 2012 23:06:18 +0100 Subject: [PATCH] readdirents(2) now returns ERANGE if insufficient storage space was provided, but that the needed size could be copied to d_namelen. --- sortix/directory.cpp | 2 +- sortix/fs/devfs.cpp | 2 +- sortix/fs/initfs.cpp | 2 +- sortix/fs/ramfs.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sortix/directory.cpp b/sortix/directory.cpp index 3040c435..e37f9598 100644 --- a/sortix/directory.cpp +++ b/sortix/directory.cpp @@ -65,7 +65,7 @@ namespace Sortix // space buffer is empty on the next call, so that'll probably // succeed. The directory read function will store the number of // bytes needed in the d_namelen variable and set errno to - // EINVAL such that userspace knows we need a larger buffer. + // ERANGE such that userspace knows we need a larger buffer. if ( dir->Read(dirent, size) ) { return (prev) ? 0 : -1; } // Insert the current dirent into the single-linked list for diff --git a/sortix/fs/devfs.cpp b/sortix/fs/devfs.cpp index 634fa9fa..bf24018e 100644 --- a/sortix/fs/devfs.cpp +++ b/sortix/fs/devfs.cpp @@ -317,7 +317,7 @@ namespace Sortix if ( available < needed ) { dirent->d_namelen = needed; - Error::Set(EINVAL); + Error::Set(ERANGE); return 0; } diff --git a/sortix/fs/initfs.cpp b/sortix/fs/initfs.cpp index 5578ac8b..1cf74921 100644 --- a/sortix/fs/initfs.cpp +++ b/sortix/fs/initfs.cpp @@ -184,7 +184,7 @@ namespace Sortix if ( available < needed ) { dirent->d_namelen = needed; - Error::Set(EINVAL); + Error::Set(ERANGE); return 0; } diff --git a/sortix/fs/ramfs.cpp b/sortix/fs/ramfs.cpp index 0879db4f..ff759c7d 100644 --- a/sortix/fs/ramfs.cpp +++ b/sortix/fs/ramfs.cpp @@ -222,7 +222,7 @@ namespace Sortix if ( available < needed ) { dirent->d_namelen = needed; - Error::Set(EINVAL); + Error::Set(ERANGE); return 0; }