mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
util: replace strerror/strerror_r with g_strerror
g_strerror is offers the safety/correctness benefits of strerror_r, with the API design convenience of strerror. Use of virStrerror should be eliminated through the codebase in favour of g_strerror. commandhelper.c is a special case as its a tiny single threaded test program, not linked to glib, so it just uses traditional strerror(). Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
@@ -37,7 +37,7 @@ linuxTestCompareFiles(const char *cpuinfofile,
|
||||
cpuinfo = fopen(cpuinfofile, "r");
|
||||
if (!cpuinfo) {
|
||||
fprintf(stderr, "unable to open: %s : %s\n",
|
||||
cpuinfofile, strerror(errno));
|
||||
cpuinfofile, g_strerror(errno));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ linuxCPUStatsToBuf(virBufferPtr buf,
|
||||
|
||||
if ((sc_clk_tck = sysconf(_SC_CLK_TCK)) < 0) {
|
||||
fprintf(stderr, "sysconf(_SC_CLK_TCK) fails : %s\n",
|
||||
strerror(errno));
|
||||
g_strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
tick_to_nsec = (1000ull * 1000ull * 1000ull) / sc_clk_tck;
|
||||
|
||||
Reference in New Issue
Block a user