From: divverent Date: Fri, 26 Nov 2010 06:02:05 +0000 (+0000) Subject: fix stdio mode X-Git-Tag: xonotic-v0.5.0~438^2~203 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=25a89453e982d94fe580096eea01dfd46c51f890;p=xonotic%2Fdarkplaces.git fix stdio mode git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10638 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/crypto-keygen-standalone.c b/crypto-keygen-standalone.c index be60446a..66a8447d 100644 --- a/crypto-keygen-standalone.c +++ b/crypto-keygen-standalone.c @@ -98,7 +98,7 @@ void file2buf(const char *fn, char **data, size_t *datasize) *datasize = 0; size_t n = 0, dn = 0; if(!strncmp(fn, "/dev/fd/", 8)) - f = fdopen(atoi(fn + 8), "wb"); + f = fdopen(atoi(fn + 8), "rb"); else f = fopen(fn, "rb"); if(!f) @@ -111,6 +111,7 @@ void file2buf(const char *fn, char **data, size_t *datasize) if(!*data) { *datasize = 0; + fclose(f); return; } dn = fread(*data + n, 1, *datasize - n, f);