mirror of
https://github.com/torvalds/linux.git
synced 2026-05-25 23:52:08 +02:00
tools/power x86_energy_perf_policy: Fix incorrect fopen mode usage
The fopen_or_die() function was previously hardcoded
to open files in read-only mode ("r"), ignoring the
mode parameter passed to it. This patch corrects
fopen_or_die() to use the provided mode argument,
allowing for flexible file access as intended.
Additionally, the call to fopen_or_die() in
err_on_hypervisor() incorrectly used the mode
"ro", which is not a valid fopen mode. This is
fixed to use the correct "r" mode.
Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
parent
cafb47be3f
commit
62127655b7
|
|
@ -630,7 +630,7 @@ void cmdline(int argc, char **argv)
|
|||
*/
|
||||
FILE *fopen_or_die(const char *path, const char *mode)
|
||||
{
|
||||
FILE *filep = fopen(path, "r");
|
||||
FILE *filep = fopen(path, mode);
|
||||
|
||||
if (!filep)
|
||||
err(1, "%s: open failed", path);
|
||||
|
|
@ -644,7 +644,7 @@ void err_on_hypervisor(void)
|
|||
char *buffer;
|
||||
|
||||
/* On VMs /proc/cpuinfo contains a "flags" entry for hypervisor */
|
||||
cpuinfo = fopen_or_die("/proc/cpuinfo", "ro");
|
||||
cpuinfo = fopen_or_die("/proc/cpuinfo", "r");
|
||||
|
||||
buffer = malloc(4096);
|
||||
if (!buffer) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user