[MPlayer-cvslog] r37636 - trunk/gui/dialog/fileselect.c

ib subversion at mplayerhq.hu
Tue Feb 9 15:23:26 CET 2016


Author: ib
Date: Tue Feb  9 15:23:26 2016
New Revision: 37636

Log:
Simplify checking for directories.

Even if a possible time-of-check/time-of-use race condition wouldn't
harm in this particular case, put Coverity to silence by trying to
change directory in the first place.

It actually makes the code less complex as well.

Modified:
   trunk/gui/dialog/fileselect.c

Modified: trunk/gui/dialog/fileselect.c
==============================================================================
--- trunk/gui/dialog/fileselect.c	Tue Feb  9 14:17:37 2016	(r37635)
+++ trunk/gui/dialog/fileselect.c	Tue Feb  9 15:23:26 2016	(r37636)
@@ -461,18 +461,14 @@ static void fs_Ok_released(GtkButton *bu
 {
     char *fsSelectedDirectory;
     int type = STREAMTYPE_FILE, ev = evPlay;
-    struct stat fs;
     gchar *selected;
 
     (void)button;
     (void)user_data;
 
-    if ((stat(fsSelectedFile, &fs) == 0) && S_ISDIR(fs.st_mode)) {
+    if (chdir(fsSelectedFile) == 0) {
         gchar *utf8dir;
 
-        if (chdir(fsSelectedFile) != 0)
-            return;
-
         CheckDir(fsFNameList);
         utf8dir = get_current_dir_name_utf8();
         gtk_entry_set_text(GTK_ENTRY(fsPathCombo), utf8dir);


More information about the MPlayer-cvslog mailing list