POSIX.1 National Language Support API for MinGW
修订版 | 8f5685cd045a2544f39a1394090737203a5c94c0 (tree) |
---|---|
时间 | 2007-05-15 04:55:09 |
作者 | Keith Marshall <keithmarshall@user...> |
Commiter | Keith Marshall |
* mcsource.c (mc_source): Close input_fd' prior to every use of return', when returning abnormally.
@@ -1,5 +1,10 @@ | ||
1 | 1 | 2007-05-14 Keith Marshall <keithmarshall@users.sourceforge.net> |
2 | 2 | |
3 | + * mcsource.c (mc_source): Close `input_fd' prior to every use | |
4 | + of `return', when returning abnormally. | |
5 | + | |
6 | +2007-05-14 Keith Marshall <keithmarshall@users.sourceforge.net> | |
7 | + | |
3 | 8 | Support all escape sequences required by POSIX 1003.1. |
4 | 9 | |
5 | 10 | * mcsource.c (OCTAL_SEQUENCE_DECODE): New manifest constant. |
@@ -9,7 +9,7 @@ | ||
9 | 9 | * used internally by `gencat', to compile message dictionaries. |
10 | 10 | * |
11 | 11 | * Written by Keith Marshall <keithmarshall@users.sourceforge.net> |
12 | - * Last modification: 12-May-2007 | |
12 | + * Last modification: 14-May-2007 | |
13 | 13 | * |
14 | 14 | * |
15 | 15 | * This is free software. It is provided AS IS, in the hope that it may |
@@ -255,7 +255,10 @@ struct msgdict *mc_source( const char *input ) | ||
255 | 255 | |
256 | 256 | dfprintf(( stderr, "\n%s:new source file\n%s:", input, input )); |
257 | 257 | if( (messages = mc_malloc( headroom = mc_workspace_wanted( fd ))) == NULL ) |
258 | + { | |
259 | + close( input_fd ); | |
258 | 260 | return NULL; |
261 | + } | |
259 | 262 | |
260 | 263 | msgloc = (off_t)(0); |
261 | 264 | while( (fd >= 0) && ((count = read( fd, buf, sizeof( buf ) )) > 0) ) |
@@ -490,6 +493,7 @@ struct msgdict *mc_source( const char *input ) | ||
490 | 493 | */ |
491 | 494 | dfputc(( '\n', stderr )); |
492 | 495 | gencat_errno = mc_errout( FATAL( MSG_SETNUM_NOT_INCR ), setnum, accumulator ); |
496 | + close( input_fd ); | |
493 | 497 | return NULL; |
494 | 498 | } |
495 | 499 | break; |
@@ -601,6 +605,7 @@ struct msgdict *mc_source( const char *input ) | ||
601 | 605 | */ |
602 | 606 | dfputc(( '\n', stderr )); |
603 | 607 | gencat_errno = mc_errout( FATAL( MSG_MSGNUM_NOT_INCR ), msgnum, accumulator ); |
608 | + close( input_fd ); | |
604 | 609 | return NULL; |
605 | 610 | } |
606 | 611 | status |= ( MSGTEXT | ENCODED ); |
@@ -836,6 +841,7 @@ struct msgdict *mc_source( const char *input ) | ||
836 | 841 | if( (messages = realloc( messages, msgloc + headroom )) == NULL ) |
837 | 842 | { |
838 | 843 | gencat_errno = mc_errout( FATAL( MSG_OUT_OF_MEMORY )); |
844 | + close( input_fd ); | |
839 | 845 | return NULL; |
840 | 846 | } |
841 | 847 | } |