Re: GError
- From: Dylan Griffiths <dylang+gtk_devel thock com>
- To: Tim Janik <timj gtk org>
- Cc: GTK development <gtk-devel-list gnome org>
- Subject: Re: GError
- Date: Sat, 24 Jun 2000 02:21:47 -0600
Tim Janik wrote:
> error throwing code example:
> {
>   gint fd = open ("/tmp/myspool", O_CREAT);
> 
>   if (fd < 0 && (errno == EMFILE || errno == ENFILE))
>     return foo_error_ofr (errno, "filedescriptors",
>                           "failed to open %s", "/tmp/myspool");
> 
> error handling code:
>   if (g_error_is_a (G_ERROR (error), foo_ofr))
>     g_print ("Stamp-%u: %s: No %s available\n",
>              error->stamp, error->base->blurb, error->resource);
> 
Perhaps this is a bit out of line, but if you're going to do * in /tmp or
involving temporary files, please use mkstemp
(http://support.cygnus.com/cygwin/4_libs/a_GNUPro_C_Library/libcmktemp_mkstempgenerate_unused_fi.html),
as it's fairly secure and avoids things like predictable names (symlink
problems), and such.  Thanks :)
-- 
    www.kuro5hin.org -- more than a state of mind.
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]