Re: [patch] Re: [Utopia] GVM - fstab symlink patch
- From: Sjoerd Simons <sjoerd luon net>
- To: Jerry Haltom <wasabi larvalstage net>
- Cc: utopia-list gnome org, Sjoerd Simons <sjoerd luon net>
- Subject: Re: [patch] Re: [Utopia] GVM - fstab symlink patch
- Date: Sun, 15 Aug 2004 19:12:16 +0200
On Sun, Aug 15, 2004 at 11:45:04AM -0500, Jerry Haltom wrote:
> Since that was my first C... can you explain some things:
>
> 1. Why was GError overkill? I thought using GError made for cleaner
> code, with much better defined exit conditions, etc.
In general it is. But in this case GError was used just to give an error string
to the calling function to print it as an error. So you can print it just as
well in the function itself. Things would ofcouse be different if the error was
propagated further.
> 2. Why warn() and not g_warning()? What's the difference? Shouldn't we
> be using g_ stuff?
warn is defined as:
#define warn(fmt,arg...) g_warning("%s/%d: " fmt,__FILE__,__LINE__,##arg)
So it's just a g_warning with some extra text prepended. This is uses througout
the whole code base, so better to keep consistent.
> (I noticed readlink() resolved to the absolute path,
> unlike g_file_read_link, so I thought it would save time, but I see how
> you did that and I like it better. I don't like readlink either.)
I found your use of readlink troublesome because of the following reasons:
* I couldn't find proof that readlink is guaranteed to return an absolute path.
g_file_read_link should be like the POSIX readlink and it doesn't so...
* readlink was called on all mnt_fsname entries, not just files. So it tries to
resolve for example ``proc'' on my systems
* readlink was also called on real files and not just symlinks. It's valid
behaviour for readlink to fail when the path is not a symlink and set errno
to EINVAL
* readlink doesn't give an error when you resolve a dangling symlink, but mount
will fail on that.
Hope this helps :)
Sjoerd
--
To give of yourself, you must first know yourself.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]