]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
fix stdio mode
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 26 Nov 2010 06:02:05 +0000 (06:02 +0000)
committerRudolf Polzer <divVerent@xonotic.org>
Fri, 26 Nov 2010 12:00:15 +0000 (13:00 +0100)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10638 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=25a89453e982d94fe580096eea01dfd46c51f890

crypto-keygen-standalone.c

index be60446ad680654439352cdf95e8bfa641e4454f..66a8447df63aeace6ebd5badd8e5bdf1979972fa 100644 (file)
@@ -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);