The F_data_not tests are missing, add them.
The EBADF is returning F_directory_descriptor.
In this specific case, the descriptor is not for a directory per-say but for a general file.
The F_file_descriptor code should be returned in this case.
This has been revealed by the unit tests that I am writing.
#ifndef _di_f_file_link_hard_at_
f_status_t f_file_link_hard_at(const int at_id_target, const int at_id_point, const f_string_static_t target, const f_string_static_t point, const int flag) {
+ if (!target.used || !point.used) {
+ return F_data_not;
+ }
+
if (linkat(at_id_target, target.string, at_id_point, point.string, flag) < 0) {
if (errno == EACCES) return F_status_set_error(F_access_denied);
- if (errno == EBADF) return F_status_set_error(F_directory_descriptor);
+ if (errno == EBADF) return F_status_set_error(F_file_descriptor);
if (errno == EDQUOT) return F_status_set_error(F_filesystem_quota_block);
if (errno == EEXIST) return F_status_set_error(F_file_found);
if (errno == EFAULT) return F_status_set_error(F_buffer);
* F_busy (with error bit) if file system is too busy to perform write.
* F_directory_descriptor (with error bit) when either at_id_target or at_id_point is not a valid file descriptor (at_id must point to a directory).
* F_directory_not (with error bit) if a supposed directory in path is not actually a directory.
+ * F_file_descriptor (with error bit) if file descriptor is invalid.
* F_file_found (with error bit) if a file aleady exists at the path.
* F_file_found_not (with error bit) if a parent path in point does not exist or is a broken symlink.
* F_filesystem_quota_block (with error bit) if file system's disk blocks or inodes are exhausted.
#if !defined(_di_f_file_link_read_) || !defined(_di_f_file_copy_)
f_status_t private_f_file_link_read(const f_string_static_t path, const struct stat link_stat, f_string_dynamic_t * const target) {
- // create a NULL terminated string based on file stat.
+ // Create a NULL terminated string based on file stat.
if (link_stat.st_size + 1 > target->size) {
if (link_stat.st_size + 1 > F_array_length_t_size_d) {
return F_status_set_error(F_string_too_large);