From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18455 invoked by alias); 15 Jun 2012 03:49:58 -0000 Received: (qmail 17375 invoked by uid 22791); 15 Jun 2012 03:46:15 -0000 X-SWARE-Spam-Status: No, hits=-3.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org From: "law at redhat dot com" To: libc-locales@sources.redhat.com Subject: [Bug localedata/14247] New: newlocale doesn't always set errno upon failure return Date: Fri, 15 Jun 2012 03:49:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: localedata X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: law at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact libc-locales-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: libc-locales-owner@sourceware.org X-SW-Source: 2012-q2/txt/msg00189.txt.bz2 http://sourceware.org/bugzilla/show_bug.cgi?id=14247 Bug #: 14247 Summary: newlocale doesn't always set errno upon failure return Product: glibc Version: 2.15 Status: NEW Severity: normal Priority: P2 Component: localedata AssignedTo: unassigned@sourceware.org ReportedBy: law@redhat.com CC: libc-locales@sources.redhat.com Classification: Unclassified Created attachment 6449 --> http://sourceware.org/bugzilla/attachment.cgi?id=6449 Potential fix newlocale() neglects to set errno to an appropriate value when failing, if it has already been asked about the same incorrect locale name. #include #include #include int main(int argc, char **argv) { locale_t loc; setlocale(LC_ALL, "C"); errno = 0; loc = newlocale(LC_COLLATE_MASK | LC_CTYPE_MASK, "nb_no.utf8", 0); printf("result = %p errno = %d\n", loc, errno); errno = 0; loc = newlocale(LC_COLLATE_MASK | LC_CTYPE_MASK, "nb_no.utf8", 0); printf("result = %p errno = %d\n", loc, errno); return 0; } Actual results: result = (nil) errno = 2 result = (nil) errno = 0 Expected results: result = (nil) errno = 2 result = (nil) errno = 2 (or at least something other than 0) -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.