Use system error code instead.
BAD_ROW_NUM "invalid row number"
INDEX_CORRUPTION "index corruption detected"
INVALID_OBJECT "reference to invalid object"
-STAT "can not stat file"
LSEEK "lseek error"
BUSY "table is busy"
SHORT_TABLE "table too short"
#include "log.h"
#include "osl.h"
#include "error.h"
+#include "fd.h"
/**
* Wrapper for the write system call.
int ret;
struct stat statbuf;
- ret = -E_OSL_STAT;
- if (stat(path, &statbuf) < 0)
+ ret = osl_stat(path, &statbuf);
+ if (ret < 0)
goto out;
ret = -E_OSL_BAD_SIZE;
if (statbuf.st_size < size)
return -ERRNO_TO_ERROR(errno);
return 1;
}
+
+_static_inline_ int osl_stat(const char *path, struct stat *buf)
+{
+ if (stat(path, buf) >= 0)
+ return 1;
+ return -ERRNO_TO_ERROR(errno);
+}
{
struct stat statbuf;
char *filename = column_filename(t, col_num);
- int ret = -E_OSL_STAT;
+ int ret;
if (!filename)
return -ERRNO_TO_ERROR(ENOMEM);
- if (stat(filename, &statbuf) < 0) {
+ ret = osl_stat(filename, &statbuf);
+ if (ret < 0) {
free(filename);
return ret;
}