Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
JohnConnett opened this issue Jun 6, 2023 · 0 comments
Open

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

JohnConnett opened this issue Jun 6, 2023 · 0 comments

Comments

@JohnConnett
Copy link

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";
     }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant