ldpart.c (128650) | ldpart.c (241046) |
---|---|
1/* 2 * Copyright (c) 2000, 2001 Alexey Zelkin <phantom@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 2000, 2001 Alexey Zelkin <phantom@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/lib/libc/locale/ldpart.c 128650 2004-04-25 19:56:50Z ache $"); | 28__FBSDID("$FreeBSD: head/lib/libc/locale/ldpart.c 241046 2012-09-29 11:54:34Z jilles $"); |
29 30#include "namespace.h" 31#include <sys/types.h> 32#include <sys/stat.h> 33 34#include <errno.h> 35#include <fcntl.h> 36#include <limits.h> --- 45 unchanged lines hidden (view full) --- 82 /* 'PathLocale' must be already set & checked. */ 83 84 /* Range checking not needed, 'name' size is limited */ 85 strcpy(filename, _PathLocale); 86 strcat(filename, "/"); 87 strcat(filename, name); 88 strcat(filename, "/"); 89 strcat(filename, category_filename); | 29 30#include "namespace.h" 31#include <sys/types.h> 32#include <sys/stat.h> 33 34#include <errno.h> 35#include <fcntl.h> 36#include <limits.h> --- 45 unchanged lines hidden (view full) --- 82 /* 'PathLocale' must be already set & checked. */ 83 84 /* Range checking not needed, 'name' size is limited */ 85 strcpy(filename, _PathLocale); 86 strcat(filename, "/"); 87 strcat(filename, name); 88 strcat(filename, "/"); 89 strcat(filename, category_filename); |
90 if ((fd = _open(filename, O_RDONLY)) < 0) | 90 if ((fd = _open(filename, O_RDONLY | O_CLOEXEC)) < 0) |
91 return (_LDP_ERROR); 92 if (_fstat(fd, &st) != 0) 93 goto bad_locale; 94 if (st.st_size <= 0) { 95 errno = EFTYPE; 96 goto bad_locale; 97 } 98 bufsize = namesize + st.st_size; --- 68 unchanged lines hidden --- | 91 return (_LDP_ERROR); 92 if (_fstat(fd, &st) != 0) 93 goto bad_locale; 94 if (st.st_size <= 0) { 95 errno = EFTYPE; 96 goto bad_locale; 97 } 98 bufsize = namesize + st.st_size; --- 68 unchanged lines hidden --- |