-
-
Notifications
You must be signed in to change notification settings - Fork 398
nut.exe are call upsdrvctl.exe in bin. #3065
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1652,7 +1652,7 @@ int main(int argc, char **argv) | |
| #ifndef WIN32 | ||
| driverpath = xstrdup(DRVPATH); /* set default */ | ||
| #else /* WIN32 */ | ||
| driverpath = getfullpath(NULL); /* Relative path in WIN32 */ | ||
| driverpath = getfullpath(PATH_BIN); /* Relative path in WIN32 */ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the whole PR is flawed here by assuming the drivers would be in I believe here the root-cause problem is rather derived from assuming in this code spot that the tool is in same location as drivers (NULL relative path, compared to program module location), despite this (because drivers are often hidden in some The puzzle to solve here is in fact the relative path to drivers, I think, because the absolute paths built into the code may be flawed (in the default build config for Win32 in |
||
| #endif /* WIN32 */ | ||
|
|
||
| atexit(exit_cleanup); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -148,7 +148,7 @@ static DWORD run_drivers(void) | |
| char command[NUT_PATH_MAX]; | ||
| char *path; | ||
|
|
||
| path = getfullpath(PATH_BIN); | ||
| path = getfullpath(PATH_SBIN); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here the change to
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, it seems the relative path to another directory should be added with slash and dot-dot like ...but lacking the Needs some more debugging I guess. Also, the |
||
| if (nut_debug_level < 1) { | ||
| snprintf(command, sizeof(command), "%s\\upsdrvctl.exe start", path); | ||
| } else { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, the method (in
common.c) actually has a possible NULL deref problem if there is no backslash. And also looks only for that one, ignoring forward slashes (that recent Windows do accept... at least if not mixing two styles in same string - not sure yet what happens then).cmdwithdir "c:/temp\tools"- that worked okay in Win11 (as long as quotes were used, otherwise forward slash was assumed to start an invalid CLI argument)This problem probably should never happen since we parse the output of WIN32 API method
GetModuleFileName()but still that bit does not seem clean now that I looked at it.