[PATCH 0/2] New API: case_sensitive_path
This is the previously controversial 1/3 patch, split into two parts. The first patch contains these changes from last time: - set errno = 0 before readdir, and check for errors after - check for other errors from the chdir call which weren't ENOTDIR - the documentation is clarified about when you might use this function - more comprehensive tests, including the corner cases Matt mentioned. The second patch changes the chdir(2) implementation to use openat/ fdopendir. I'm not convinced that this is a good thing since the chdir implementation is much clearer to understand, and the chance of the daemon ever becoming multithreaded is next to nil. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://et.redhat.com/~rjones/libguestfs/ See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones New in Fedora 11: Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 70 libraries supprt'd http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
Richard W.M. Jones wrote:
Subject: [PATCH 2/2] daemon: Change chdir to use openat/fdopendir.
To make this work on older Linux kernels and on systems without openat, you can use gnulib's openat module. ...
+#ifndef _ATFILE_SOURCE +#define _ATFILE_SOURCE +#endif
In which case, you won't need to do the above. ...
+ int fd;
I like to call this sort of variable "fd_cwd" or something similar, so that it's easier to see that it's more than a "normal" open-on-some-file fd. Other than that, it looks fine.
- /* MUST chdir ("/") before leaving this function. */ - if (chdir (sysroot) == -1) { + /* 'fd' here is a surrogate for the current working directory, so + * that we don't have to actually call chdir(2). + */ + fd = open (sysroot, O_RDONLY | O_DIRECTORY); ...
participants (2)
-
Jim Meyering -
Richard W.M. Jones