Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2022-08-31 22:18:08 +0300
committerJeff Johnston <jjohnstn@redhat.com>2022-08-31 22:18:08 +0300
commitd92d3a3c4a7af1ebe56d58c32986ab410f6071ec (patch)
treedc9d1165c287da28953546cdad9184e5828d14ab /newlib/libc/posix
parentdd1122e21cb4ea78ce4c5894787c8f085469f9dd (diff)
Fix some Coverity Scan errors.
Diffstat (limited to 'newlib/libc/posix')
-rw-r--r--newlib/libc/posix/sleep.c3
-rw-r--r--newlib/libc/posix/usleep.c1
2 files changed, 2 insertions, 2 deletions
diff --git a/newlib/libc/posix/sleep.c b/newlib/libc/posix/sleep.c
index f7c780ef0..0d6cd710d 100644
--- a/newlib/libc/posix/sleep.c
+++ b/newlib/libc/posix/sleep.c
@@ -7,6 +7,7 @@
#include <errno.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
unsigned sleep(unsigned seconds)
{
@@ -15,7 +16,7 @@ unsigned sleep(unsigned seconds)
ts.tv_sec = seconds;
ts.tv_nsec = 0;
if (!nanosleep(&ts,&ts)) return 0;
- if (errno == EINTR) return ts.tv_sec;
+ if (errno == EINTR) return ts.tv_sec & UINT_MAX;
return -1;
}
diff --git a/newlib/libc/posix/usleep.c b/newlib/libc/posix/usleep.c
index 9322b6551..cc1b31408 100644
--- a/newlib/libc/posix/usleep.c
+++ b/newlib/libc/posix/usleep.c
@@ -15,7 +15,6 @@ int usleep(useconds_t useconds)
ts.tv_sec = (long int)useconds / 1000000;
ts.tv_nsec = ((long int)useconds % 1000000) * 1000;
if (!nanosleep(&ts,&ts)) return 0;
- if (errno == EINTR) return ts.tv_sec;
return -1;
}