public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
From: Paul Kunysch <paul.kunysch@emsys.de>
To: cygwin-patches@cygwin.com
Subject: Fix sem_getvalue
Date: Wed, 18 Sep 2013 09:53:00 -0000	[thread overview]
Message-ID: <52397810.1070600@emsys.de> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 861 bytes --]

Hello

In 1.7.24 and 1.7.25 sem_getvalue() returns the current value instead of 
setting the out-parameter and returning 0/-1 for success/error.

I attached a simple fix.

I don't know if this should be further improved by setting errno to 
EINVAL if STATUS_INVALID_HANDLE == status.

Unfortunately I wasn't able to run and extend the unit tests.  Running 
"make check" fails with "No rule to make target `dataascii.o', needed by 
`libltp.a'".  The VPATH seems to be extended correctly.

Kind regards,
Paul
-- 

Kunysch, Paul
Software Development

emsys Embedded Systems GmbH
Werner von Siemens Str. 20
98693 Ilmenau
Germany

Tel.: +49 3677 68977-16   Fax: +49 3677 68977-19
E-Mail: paul.kunysch@emsys.de
Internet: www.emsys.de

CEO: Dr.-Ing. Karsten Pahnke
office: Ilmenau
Register of commerce in county court Jena: HRB 304988

[-- Attachment #1.2: patch.txt --]
[-- Type: text/plain, Size: 668 bytes --]

Index: winsup/cygwin/thread.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/thread.cc,v
retrieving revision 1.285
diff -u -p -r1.285 thread.cc
--- winsup/cygwin/thread.cc	23 Jul 2013 14:15:20 -0000	1.285
+++ winsup/cygwin/thread.cc	17 Sep 2013 17:45:26 -0000
@@ -3443,9 +3443,8 @@ semaphore::_getvalue (int *sval)
 
   status = NtQuerySemaphore (win32_obj_id, SemaphoreBasicInformation, &sbi,
 			     sizeof sbi, NULL);
-  if (NT_SUCCESS (status))
-    return sbi.CurrentCount;
-  return startvalue;
+  *sval = (NT_SUCCESS(status)) ? sbi.CurrentCount : startvalue;
+  return 0;
 }
 
 int

[-- Attachment #2: S/MIME Kryptografische Unterschrift --]
[-- Type: application/pkcs7-signature, Size: 3973 bytes --]

             reply	other threads:[~2013-09-18  9:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-18  9:53 Paul Kunysch [this message]
2013-09-18 18:12 ` Christopher Faylor
     [not found] <52389689.1030801@emsys.de>
2013-09-25 10:42 ` Paul Kunysch
2013-09-25 14:46   ` Christopher Faylor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52397810.1070600@emsys.de \
    --to=paul.kunysch@emsys.de \
    --cc=cygwin-patches@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).