tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[PATCH 1/6] fix ambiguous errno treating after mktime()



The SUSv3 describes errno value only for C extension, but we can reset errno to
drop ambiguous treating its value.
---
 lib/libc/time/localtime.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/lib/libc/time/localtime.c b/lib/libc/time/localtime.c
index bf23c2d..5ad47ac 100644
--- a/lib/libc/time/localtime.c
+++ b/lib/libc/time/localtime.c
@@ -1599,7 +1599,7 @@ const long                offset;
                lclptr : gmtptr);
 #ifdef ALL_STATE
        if (sp == NULL)
-               return WRONG;
+               goto time1_error;
 #endif /* defined ALL_STATE */
        for (i = 0; i < sp->typecnt; ++i)
                seen[i] = FALSE;
@@ -1628,6 +1628,11 @@ const long               offset;
                        tmp->tm_isdst = !tmp->tm_isdst;
                }
        }
+time1_error:
+       /*
+        * Reset errno to fix ambiguous with the SuSv3 mktime().
+        */
+       errno = 0;
        return WRONG;
 }
 
-- 
1.5.2.5



Home | Main Index | Thread Index | Old Index