public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin/main] Cygwin: fallocate(2): fix evaluating return value
@ 2023-11-28 10:03 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2023-11-28 10:03 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=114f89caff7b9b62b0b12bc2c6d143daf47b8042

commit 114f89caff7b9b62b0b12bc2c6d143daf47b8042
Author:     Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Mon Nov 27 21:17:12 2023 +0100
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Tue Nov 28 10:55:38 2023 +0100

    Cygwin: fallocate(2): fix evaluating return value
    
    fallocate is not supposed to return an errno code, it has to
    return -1 and set errno.
    
    Fixes: dd90ede40510 ("Cygwin: introduce fallocate(2)")
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/syscalls.cc | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 0e4c54bcfae9..b73391d8f84e 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -3017,8 +3017,13 @@ fallocate (int fd, int mode, off_t offset, off_t len)
       if (res == EISDIR)
 	res = ENODEV;
     }
+  if (res)
+    {
+      set_errno (res);
+      res = -1;
+    }
   syscall_printf ("%R = posix_fallocate(%d, %D, %D)", res, fd, offset, len);
-  return 0;
+  return res;
 }
 
 extern "C" int

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-11-28 10:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-28 10:03 [newlib-cygwin/main] Cygwin: fallocate(2): fix evaluating return value Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).