Re: trouble with g_stat

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jun 03, 2018 at 10:27:48PM -0400, GaryW wrote:
> My use of g_stat causes a segfault, but regular stat works ok. I’m using
> mingw64 on Win10 under msys2.
> [...]
> 
> GString *fspec;
> 
> GStatBuf *stBuf;
> 
> //fspec->str tested to hold the correct file spec…
> 
> if(g_stat(fspec->str,stBuf)<0){… [9476 Segmentation fault]

stBuf is an uninitialised pointer.  g_stat will try to write to the
address; undefined behaviour results.

Try allocating some memory of the right size, and assign that address
to the pointer before calling g_stat?

-- 
James Cameron
http://quozl.netrek.org/
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list




[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux