mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
(search_content): minor refactoring of file opening.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
e113055175
commit
127f975657
@ -1010,7 +1010,7 @@ search_content (WDialog * h, const char *directory, const char *filename)
|
|||||||
{
|
{
|
||||||
struct stat s;
|
struct stat s;
|
||||||
char buffer[BUF_4K] = ""; /* raw input buffer */
|
char buffer[BUF_4K] = ""; /* raw input buffer */
|
||||||
int file_fd;
|
int file_fd = -1;
|
||||||
gboolean ret_val = FALSE;
|
gboolean ret_val = FALSE;
|
||||||
vfs_path_t *vpath;
|
vfs_path_t *vpath;
|
||||||
gint64 tv;
|
gint64 tv;
|
||||||
@ -1018,13 +1018,9 @@ search_content (WDialog * h, const char *directory, const char *filename)
|
|||||||
|
|
||||||
vpath = vfs_path_build_filename (directory, filename, (char *) NULL);
|
vpath = vfs_path_build_filename (directory, filename, (char *) NULL);
|
||||||
|
|
||||||
if (mc_stat (vpath, &s) != 0 || !S_ISREG (s.st_mode))
|
if (mc_stat (vpath, &s) == 0 && S_ISREG (s.st_mode))
|
||||||
{
|
file_fd = mc_open (vpath, O_RDONLY);
|
||||||
vfs_path_free (vpath, TRUE);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
file_fd = mc_open (vpath, O_RDONLY);
|
|
||||||
vfs_path_free (vpath, TRUE);
|
vfs_path_free (vpath, TRUE);
|
||||||
|
|
||||||
if (file_fd == -1)
|
if (file_fd == -1)
|
||||||
|
Loading…
Reference in New Issue
Block a user