Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if (TESTS)
endif()

if (DEBUG)
add_compile_options($<$<C_COMPILER_ID:Clang>:-ggdb>)
set(CMAKE_BUILD_TYPE Debug)
endif()

if (SANITIZER)
Expand Down
10 changes: 5 additions & 5 deletions src/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ ex_status ex_device_read_to_buffer(ssize_t *readed, char *buffer, size_t off,
goto failure;
}

off_t offset = lseek(fd, off, SEEK_SET);

if ((off_t)off < 0) {
status = INVALID_OFFSET;
goto failure;
}

off_t offset = lseek(fd, off, SEEK_SET);

if ((size_t)offset != off) {
status = OFFSET_SEEK_FAILED;
goto failure;
Expand All @@ -97,7 +97,7 @@ ex_status ex_device_read_to_buffer(ssize_t *readed, char *buffer, size_t off,
error("device is not opened");
break;
case INVALID_OFFSET:
error("lseek: underthrow (off > max(int))");
error("lseek: underthrow (off > max(int)) (%li, %zu)", off, off);
break;
case OFFSET_SEEK_FAILED:
error("lseek: offset=%li, wanted=%lu", offset, off);
Expand All @@ -122,13 +122,13 @@ ex_status ex_device_write(size_t off, const char *data, size_t amount) {
goto failure;
}

off_t offset = lseek(fd, off, SEEK_SET);

if ((off_t)off < 0) {
status = INVALID_OFFSET;
goto failure;
}

off_t offset = lseek(fd, off, SEEK_SET);

if ((size_t)offset != off) {
status = OFFSET_SEEK_FAILED;
goto failure;
Expand Down
1 change: 1 addition & 0 deletions src/errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ typedef enum {
INODE_LOAD_FAILED,
INODE_IS_NOT_UNLINKABLE,
INODE_NOT_FOUND,
PARENT_BLOCK_CANNOT_BE_READED,
OK
} ex_status;

Expand Down
2 changes: 2 additions & 0 deletions src/ex.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ int ex_getattr(const char *pathname, struct stat *st) {

st->st_nlink = inode->nlinks;
st->st_size = inode->size;
st->st_blocks = inode->nblocks;
st->st_blksize = EX_BLOCK_SIZE;
st->st_mode = inode->mode;
st->st_ino = inode->number;

Expand Down
Loading