Let's check the file node type when we open/stat journal files: refuse
anything that is not a regular file...
f->last_stat_usec = now(CLOCK_MONOTONIC);
+ /* Refuse dealing with with files that aren't regular */
+ if (S_ISDIR(f->last_stat.st_mode))
+ return -EISDIR;
+ if (!S_ISREG(f->last_stat.st_mode))
+ return -EBADFD;
+
/* Refuse appending to files that are already deleted */
if (f->last_stat.st_nlink <= 0)
return -EIDRM;
goto fail;
}
+ if (S_ISDIR(st.st_mode)) {
+ r = -EISDIR;
+ goto fail;
+ }
if (!S_ISREG(st.st_mode)) {
r = -EBADFD;
goto fail;