Re: glib outstanding stuff
- From: Joel Becker <jlbec evilplan org>
- To: Havoc Pennington <hp redhat com>
- Cc: gtk-devel-list gnome org
- Subject: Re: glib outstanding stuff
- Date: Thu, 5 Oct 2000 18:57:24 +0100
On Thu, Oct 05, 2000 at 01:37:28PM -0400, Havoc Pennington wrote:
> static gboolean
> get_contents_posix (const gchar *filename,
> gchar **contents,
> guint *length,
> GError **error)
> {
...
>
> if (S_ISREG (stat_buf.st_mode))
> {
> return get_contents_regfile (filename,
> &stat_buf,
> fd,
> contents,
> length,
> error);
> }
> else
> {
...
> }
> }
Note that /proc/foo will return S_ISREG() and
(stat_buf.st_size == 0), so you really need to check for that case and
pass it to get_contents_stdio(), not get_contents_regfile(). If the
size of said file really is 0, get_contents_stdio() will hit EOF just
fine.
Joel
--
"Heav'n hath no rage like love to hatred turn'd, nor Hell a fury,
like a woman scorn'd."
- William Congreve
http://www.jlbec.org/
jlbec evilplan org
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]