Forráskód Böngészése

Allow block device file to -i option

Tatsuhiro Tsujikawa 9 éve
szülő
commit
14e995d2bc
1 módosított fájl, 4 hozzáadás és 2 törlés
  1. 4 2
      src/download_helper.cc

+ 4 - 2
src/download_helper.cc

@@ -529,8 +529,10 @@ std::shared_ptr<UriListParser> openUriListParser(const std::string& filename)
     listPath = DEV_STDIN;
   }
   else {
-    if (!File(filename).isFile()) {
-      throw DL_ABORT_EX(fmt(EX_FILE_OPEN, filename.c_str(), "No such file"));
+    auto f = File(filename);
+    if (!f.exists() || f.isDir()) {
+      throw DL_ABORT_EX(fmt(EX_FILE_OPEN, filename.c_str(),
+                            "File not found or it is a directory"));
     }
     listPath = filename;
   }