mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-30 00:40:20 +02:00
(scm_setlocale): Force errno=EINVAL for an error, since
POSIX and C99 don't document errno being set. Reported by Bruno Haible.
This commit is contained in:
parent
92277bd59d
commit
7398c4370a
1 changed files with 8 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2004 Free Software Foundation, Inc.
|
/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2004, 2005 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1295,7 +1295,13 @@ SCM_DEFINE (scm_setlocale, "setlocale", 1, 1, 0,
|
||||||
|
|
||||||
rv = setlocale (SCM_INUM (category), clocale);
|
rv = setlocale (SCM_INUM (category), clocale);
|
||||||
if (rv == NULL)
|
if (rv == NULL)
|
||||||
SCM_SYSERROR;
|
{
|
||||||
|
/* POSIX and C99 don't say anything about setlocale setting errno, so
|
||||||
|
force a sensible value here. glibc leaves ENOENT, which would be
|
||||||
|
fine, but it's not a documented feature. */
|
||||||
|
errno = EINVAL;
|
||||||
|
SCM_SYSERROR;
|
||||||
|
}
|
||||||
return scm_makfrom0str (rv);
|
return scm_makfrom0str (rv);
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue