sedutil icon indicating copy to clipboard operation
sedutil copied to clipboard

Hard coded "/dev/sda" in DtaDevLinuxSata::init

Open JohnConnett opened this issue 2 years ago • 0 comments

Looking at the code I noticed that access() is being called with "/dev/sda" rather than devref. Might cause problems, especially on systems that don't have a /dev/sda! Suggested fix below:

diff --git a/linux/DtaDevLinuxSata.cpp b/linux/DtaDevLinuxSata.cpp
index fa71bd3..d7e90cd 100644
--- a/linux/DtaDevLinuxSata.cpp
+++ b/linux/DtaDevLinuxSata.cpp
@@ -67,7 +67,7 @@ bool DtaDevLinuxSata::init(const char * devref)
     LOG(D1) << "Creating DtaDevLinuxSata::DtaDev() " << devref;
        bool isOpen = FALSE;
 
-    if(access("/dev/sda", R_OK | W_OK)) {
+    if(access(devref, R_OK | W_OK)) {
         LOG(E) << "You do not have permission to access the raw disk in write mode";
         LOG(E) << "Perhaps you might try sudo to run as root";
     }

JohnConnett avatar Jun 06 '23 15:06 JohnConnett