Hi everyone.

I recently downloaded a copy of sunrpc for use on a project I am working on
and began receiving errors when trying to compile a .x file.  I am on
Windows 7, 64 bit and its part of a large QT / Mingw project.  I was using
the command

rpcgen -Y C:\Mingw\bin -C -c -o xdraircraft.cpp xdraircraft.x

It works fine on Linux (We dont even need the -Y flag there) but did not
work from within QT creator.  All I saw was the error message "fopen"
access denied.  After downloading the source I identified the problem.  It
is using tmpnam which returns something like \abcd1. in Windows.  Under the
C: drive it has a permission error unless you are compiling as an
administrator.

I made a fix in rpc_main.c that fixes this problem and uses your TMP
variable as a template to mkstemp.

//MARPOSS^M
/*^M
 * Open input file with given define for C-preprocessor^M
 */^M
static void^M
open_input(const char *infile, const char *define)^M
{^M
        char szTemp[360];^M
^M
        if (getenv("TMP")) {
           sprintf(szTempFile,"%s\\rpcXXXXXX.tmp",getenv("TMP"));
           close(mkstemp(szTempFile));
        } else {
           tmpnam(szTempFile);^M
        }
^M
        find_cpp();^M
        sprintf(szTemp, "%s %s %s %s > %s\n", CPP, CPPFLAGS, define,
infile, szTempFile);^M
        //printf(szTemp);^M
^M
        system(szTemp);^M
        fin = fopen(szTempFile, "r");^M
        if (fin == NULL) {^M
                perror(szTempFile);^M
                crash();^M
        }^M
}^M

Sorry for the ^M, I am using VIM.

Hope this helps someone out there.
-- 
Chris Benesch
BeneschTech, LLC
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
GnuWin32-Users mailing list
GnuWin32-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gnuwin32-users

Reply via email to