View Issue Details

IDProjectCategoryView StatusLast Update
0000333fileGeneralpublic2022-03-24 08:26
Reporterevyatar Assigned To 
Status newResolutionopen 
Summary0000333: Introduce a magic_file_at() function
DescriptionI suggest introducing a new libmagic API function: magic_file_at which will have the signature:
const char *magic_file_at(magic_t cookie, int dirfd, const char *path)
It behaves exactly like magic_file() except that if path is relative then it is interpreted as a relative path to the directory referred to by dirfd except if dirfd is negative in which case path is interpreted as a relative path to the current working directory.
This is analogous to the openat() family of syscalls (except that AT_FDCWD is changed with any negative value).
The rationale behind this addition is laid out in the Linux mapage for open(2) but also, in my personal experience, it simplifies the use of readdir() greatly as no string copying needs to take place to call magic_file().
TagsNo tags attached.


There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2022-03-24 08:26 evyatar New Issue