Bug 106497 - better error description when problem reading font configuration
https://bugs.freedesktop.org/show_bug.cgi?id=106497
This commit is contained in:
parent
af964f7897
commit
cfb21c7d85
|
@ -169,7 +169,7 @@ AC_TYPE_PID_T
|
||||||
# Checks for library functions.
|
# Checks for library functions.
|
||||||
AC_FUNC_VPRINTF
|
AC_FUNC_VPRINTF
|
||||||
AC_FUNC_MMAP
|
AC_FUNC_MMAP
|
||||||
AC_CHECK_FUNCS([link mkstemp mkostemp _mktemp_s mkdtemp getopt getopt_long getprogname getexecname rand random lrand48 random_r rand_r readlink fstatvfs fstatfs lstat])
|
AC_CHECK_FUNCS([link mkstemp mkostemp _mktemp_s mkdtemp getopt getopt_long getprogname getexecname rand random lrand48 random_r rand_r readlink fstatvfs fstatfs lstat strerror strerror_r])
|
||||||
|
|
||||||
dnl AC_CHECK_FUNCS doesn't check for header files.
|
dnl AC_CHECK_FUNCS doesn't check for header files.
|
||||||
dnl posix_fadvise() may be not available in older libc.
|
dnl posix_fadvise() may be not available in older libc.
|
||||||
|
|
20
src/fcxml.c
20
src/fcxml.c
|
@ -22,6 +22,10 @@
|
||||||
* PERFORMANCE OF THIS SOFTWARE.
|
* PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef _GNU_SOURCE
|
||||||
|
#undef _GNU_SOURCE /* To use the POSIX version of strerror_r */
|
||||||
|
#endif
|
||||||
|
#include <string.h>
|
||||||
#include "fcint.h"
|
#include "fcint.h"
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
@ -3451,7 +3455,21 @@ _FcConfigParse (FcConfig *config,
|
||||||
len = read (fd, buf, BUFSIZ);
|
len = read (fd, buf, BUFSIZ);
|
||||||
if (len < 0)
|
if (len < 0)
|
||||||
{
|
{
|
||||||
FcConfigMessage (0, FcSevereError, "failed reading config file");
|
int errno_ = errno;
|
||||||
|
char ebuf[BUFSIZ+1];
|
||||||
|
|
||||||
|
#if HAVE_STRERROR_R
|
||||||
|
int x FC_UNUSED;
|
||||||
|
x = strerror_r (errno_, ebuf, BUFSIZ); /* make sure we use the POSIX version of strerror_r */
|
||||||
|
#elif HAVE_STRERROR
|
||||||
|
char *tmp = strerror (errno_);
|
||||||
|
size_t len = strlen (tmp);
|
||||||
|
strncpy (ebuf, tmp, FC_MIN (BUFSIZ, len));
|
||||||
|
ebuf[FC_MIN (BUFSIZ, len)] = 0;
|
||||||
|
#else
|
||||||
|
ebuf[0] = 0;
|
||||||
|
#endif
|
||||||
|
FcConfigMessage (0, FcSevereError, "failed reading config file: %s: %s (errno %d)", realfilename, ebuf, errno_);
|
||||||
close (fd);
|
close (fd);
|
||||||
goto bail1;
|
goto bail1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue