чување 0b398edbd917a02ced435bd9061972cc560f2ab5
родитељ 16372d77cff77c96d0b6bb27f939549b78875153
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Wed, 23 Feb 2022 16:02:12 +0100
sled.c: Move the test for a regular file before the test for directory write access
Signed-off-by: Страхиња Радић <contact@strahinja.org>
Diffstat:
измењених датотека: 1, додавања: 4(+), брисања: 3(-)
diff --git a/sled.c b/sled.c
@@ -1950,6 +1950,10 @@ main(int argc, char** argv)
}
goto init_termbox;
}
+
+ if (!S_ISREG(st.st_mode))
+ return print_error(EINVAL, "Is not a regular file");
+
#ifdef CREATE_BACKUPS
if (dir_access == -1)
{
@@ -1961,9 +1965,6 @@ main(int argc, char** argv)
if (access(filename, F_OK | R_OK | W_OK) == -1)
goto file_error;
- if (!S_ISREG(st.st_mode))
- return print_error(EINVAL, "Is not a regular file");
-
result = load_file(&state, &lineno, &col);
switch (result)
{