GNOME Bugzilla – Bug 106160
Implement a g_mkdir function
Last modified: 2004-12-22 21:47:04 UTC
The mkdir(2) function, present in many systems, may be incompatible between them depending on how it is called. For example, calling mkdir(2) with a trailing slash '/' in the path name will fail on NetBSD, while it works in other operating systems (Linux, for example). GLib should provide an abstraction layer to this function so that programs wanting to create directories do not have to deal with these details. This library can easily implement a g_mkdir() function which parses the filename and then calls the real mkdir function. GLib already provides directory related functions, so adding this one here is a good idea, imho. This issue could be solved in the operating system's itself, but developers disagree. Solving it in GLib means that even old versions of the operating systems (not fixed) will take advantadge of this feature. It could also be solved on a program basis, but this makes things harder for developers that don't want to mess with OS specific details.
Created attachment 14348 [details] [review] A simple patch that implements the g_mkdir function
I think programs that are calling mkdir() with a trailing slash are simply broken. I see nothing in POSIX that would allow it.