[GRASS-dev] tmpfile() -> G_asprintf fails on Win/MinGW

Hi,
attached is critical bugfix for G_asprintf(). tmpfile() fails on Windows/MinGW
if user des not have enough permissions on the drive (top dir) where he is
currently working.
Please apply to both HEAD and 6.2 release.

BTW, I dont think G_asprintf should be used in this cases:
  G_asprintf(&datumlongname, "unknown");
  G_asprintf(&ellps, "unnamed");
  G_asprintf( &pszDatumName, pszDatumNameConst );

Radim

(attachments)

asprintf.c.patch1 (889 Bytes)

On Fri, Oct 06, 2006 at 05:35:29PM +0200, Radim Blazek wrote:

Hi,
attached is critical bugfix for G_asprintf(). tmpfile() fails on
Windows/MinGW
if user des not have enough permissions on the drive (top dir) where he is
currently working.
Please apply to both HEAD and 6.2 release.

Patch applied to both repositories (I have changed the C++ style comment, though).

Markus

BTW, I dont think G_asprintf should be used in this cases:
G_asprintf(&datumlongname, "unknown");
G_asprintf(&ellps, "unnamed");
G_asprintf( &pszDatumName, pszDatumNameConst );

Radim

Thanks,
unfortunately I found that it would not work when no mapset is open
(read only access) so I changed it to use Windows native functions to get temp
file. Another patch is attached.

Radim

On 10/6/06, Markus Neteler <neteler@itc.it> wrote:

On Fri, Oct 06, 2006 at 05:35:29PM +0200, Radim Blazek wrote:
> Hi,
> attached is critical bugfix for G_asprintf(). tmpfile() fails on
> Windows/MinGW
> if user des not have enough permissions on the drive (top dir) where he is
> currently working.
> Please apply to both HEAD and 6.2 release.

Patch applied to both repositories (I have changed the C++ style comment, though).

Markus

> BTW, I dont think G_asprintf should be used in this cases:
> G_asprintf(&datumlongname, "unknown");
> G_asprintf(&ellps, "unnamed");
> G_asprintf( &pszDatumName, pszDatumNameConst );
>
> Radim

_______________________________________________
grass-dev mailing list
grass-dev@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass-dev

(attachments)

asprintf.c.patch2 (1.2 KB)

On Fri, Oct 06, 2006 at 08:38:07PM +0200, Radim Blazek wrote:

Thanks,
unfortunately I found that it would not work when no mapset is open
(read only access) so I changed it to use Windows native functions to get
temp
file. Another patch is attached.

Radim

Patch applied to 6.3-CVS and 6.2-rel-branch.

Markus

PS: Concerning your re-activation of ssh CVS write access, I
suspect that you may be missing "-1" in $HOME/.ssh2402
Mine is looking like this:

cat $HOME/.ssh2402
#!/bin/sh
ssh -1 -p 2402 $*