View | Details | Raw Unified | Return to bug 172805 | Differences between
and this patch

Collapse All | Expand All

(-)lib/libc/nls/catopen.3 (-3 / +6 lines)
Lines 27-33 Link Here
27
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
.\"
28
.\"
29
.\" $FreeBSD$
29
.\" $FreeBSD$
30
.Dd February 12, 2005
30
.Dd October 17, 2012
31
.Dt CATOPEN 3
31
.Dt CATOPEN 3
32
.Os
32
.Os
33
.Sh NAME
33
.Sh NAME
Lines 132-141 Otherwise, (nl_catd) -1 is returned and Link Here
132
is set to indicate the error.
132
is set to indicate the error.
133
.Sh ERRORS
133
.Sh ERRORS
134
.Bl -tag -width Er
134
.Bl -tag -width Er
135
.It Bq Er EFTYPE
136
The named message catalog is corrupt.
135
.It Bq Er EINVAL
137
.It Bq Er EINVAL
136
Argument
138
Argument
137
.Fa name
139
.Fa name
138
does not point to a valid message catalog, or catalog is corrupt.
140
points to
141
.Dv NULL .
139
.It Bq Er ENAMETOOLONG
142
.It Bq Er ENAMETOOLONG
140
An entire path to the message catalog exceeded 1024 characters.
143
An entire path to the message catalog exceeded 1024 characters.
141
.It Bq Er ENOENT
144
.It Bq Er ENOENT
Lines 154-157 Insufficient memory is available. Link Here
154
The
157
The
155
.Fn catopen
158
.Fn catopen
156
function conforms to
159
function conforms to
157
.St -p1003.1-2001 .
160
.St -p1003.1-2008 .
(-)lib/libc/nls/msgcat.c (-4 / +8 lines)
Lines 119-126 catopen(const char *name, int type) Link Here
119
	char path[PATH_MAX];
119
	char path[PATH_MAX];
120
120
121
	/* sanity checking */
121
	/* sanity checking */
122
	if (name == NULL || *name == '\0')
122
	if (name == NULL)
123
		NLRETERR(EINVAL);
123
		NLRETERR(EINVAL);
124
	if (*name == '\0')
125
		NLRETERR(ENOENT);
124
126
125
	if (strchr(name, '/') != NULL)
127
	if (strchr(name, '/') != NULL)
126
		/* have a pathname */
128
		/* have a pathname */
Lines 367-372 load_msgcat(const char *path, const char *name, const char *lang) Link Here
367
	struct catentry *np;
369
	struct catentry *np;
368
	void *data;
370
	void *data;
369
	int fd;
371
	int fd;
372
	int saved_errno;
370
373
371
	/* path/name will never be NULL here */
374
	/* path/name will never be NULL here */
372
375
Lines 390-398 load_msgcat(const char *path, const char *name, const char *lang) Link Here
390
	}
393
	}
391
394
392
	if (_fstat(fd, &st) != 0) {
395
	if (_fstat(fd, &st) != 0) {
396
		saved_errno = errno;
393
		_close(fd);
397
		_close(fd);
394
		SAVEFAIL(name, lang, EFTYPE);
398
		SAVEFAIL(name, lang, saved_errno);
395
		NLRETERR(EFTYPE);
399
		NLRETERR(saved_errno);
396
	}
400
	}
397
401
398
	/*
402
	/*
Lines 408-414 load_msgcat(const char *path, const char *name, const char *lang) Link Here
408
412
409
	if ((data = mmap(0, (size_t)st.st_size, PROT_READ,
413
	if ((data = mmap(0, (size_t)st.st_size, PROT_READ,
410
	    MAP_FILE|MAP_SHARED, fd, (off_t)0)) == MAP_FAILED) {
414
	    MAP_FILE|MAP_SHARED, fd, (off_t)0)) == MAP_FAILED) {
411
		int saved_errno = errno;
415
		saved_errno = errno;
412
		_close(fd);
416
		_close(fd);
413
		SAVEFAIL(name, lang, saved_errno);
417
		SAVEFAIL(name, lang, saved_errno);
414
		NLRETERR(saved_errno);
418
		NLRETERR(saved_errno);

Return to bug 172805