Opened 12 years ago

Closed 12 years ago

#1516 closed bug (fixed)

Various file operations fail when the filename is the empty string.

Reported by: mjw Owned by: axeld
Priority: normal Milestone: R1
Component: - General Version: R1/pre-alpha1
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All

Description

Various file operations fail when the filename is the empty string. For example, stat( "", &statbuf ) should return -1 with errno set to ENOENT, however on Haiku it returns 0. I assume statbuf will be filled with random stuff.

Other things I have tried, access( "", F_OK ) returns 0, whereas I would expect it to return -1 with errno set to ENOENT.

Things such as stat( NULL, &statbuf ) work correctly.

fopen( "", "r" ) returns a valid open FILE *, but the file can not be read from.

I assume there are other operations (like open()) that exhibit the same symptoms. I traced the code down to vnode_path_to_vnode in haiku/src/system/kernel/fs/vfs.cpp, but decided that a fix should come from somebody who knows what they are doing.

I have a noddy test case to attach to the bug.

Attachments (2)

stat_test.c (838 bytes ) - added by mjw 12 years ago.
vfs.cpp.patch (349 bytes ) - added by mjw 12 years ago.
Possible patch for haiku/src/system/kernel/fs/vfs.cpp

Download all attachments as: .zip

Change History (3)

by mjw, 12 years ago

Attachment: stat_test.c added

by mjw, 12 years ago

Attachment: vfs.cpp.patch added

Possible patch for haiku/src/system/kernel/fs/vfs.cpp

comment:1 by bonefish, 12 years ago

Resolution: fixed
Status: newclosed

Fixed in hrev22451.

Note: See TracTickets for help on using tickets.