fix fopen handle leak, static build

git-svn-id: svn://kolibrios.org@6744 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
siemargl 2016-11-23 11:13:09 +00:00
parent 09d8656eef
commit 2af7a3394b
3 changed files with 11 additions and 4 deletions

View File

@ -553,6 +553,7 @@ ifeq ($(findstring static,$(MAKECMDGOALS)),static)
LIB_SRCS:= $(STATIC_SRCS)
LIB_OBJS:= $(STATIC_OBJS)
CFLAGS += -DSTATIC_LIBC
else
@ -582,9 +583,9 @@ shared: $(NAME).dll libdll.a
$(NAME).dll: $(LIB_OBJS) $(SRC_DEP) Makefile
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $(LIB_OBJS) -lgcc --version-script libc.ver
#sed -e "s/ @[^ ]*//" libc.orig.def > libc.def
#sed -f cmd2.sed libc.def > mem
#sed -f newlib.sed mem > libc.inc
#sed -e "s/ @[^ ]*//" libc.orig.def > libc.def
#sed -f cmd2.sed libc.def > mem
#sed -f newlib.sed mem > libc.inc
install: libc.dll libc.dll.a libdll.a
mv -f libc.dll $(SDK_DIR)/bin
@ -667,6 +668,9 @@ time/wcsftime.o: time/strftime.c
%.o : %.c Makefile
$(CC) $(CFLAGS) $(DEFINES) $(INCLUDES) -o $@ $<
%.o : %.S Makefile
$(CC) $(CFLAGS) $(DEFINES) $(INCLUDES) -o $@ $<
clean:
-rm -f */*.o

View File

@ -115,6 +115,7 @@ int open (const char * filename, int flags, ...)
if(hid < 0)
{
errno = EMFILE;
__io_free(hid);
return (-1);
};
@ -136,6 +137,7 @@ int open (const char * filename, int flags, ...)
if( !err )
{
errno = EEXIST;
__io_free(hid);
return (-1);
};
}
@ -147,6 +149,7 @@ int open (const char * filename, int flags, ...)
if( err )
{
errno = EACCES;
__io_free(hid);
return -1;
};
};

View File

@ -9,7 +9,7 @@ SECTIONS
LONG(0x554e454D);
LONG(0x32305445);
LONG(1);
LONG(__start);
LONG(__crt_start);
LONG(___iend);
LONG(___memsize);
LONG(___stacktop);