Fix format string problems in error(3) calls.

This commit is contained in:
Jonas 'Sortie' Termansen 2014-07-22 15:21:22 +02:00
parent b0cbf9d0ea
commit 5f9da2a651
4 changed files with 11 additions and 10 deletions

View File

@ -674,13 +674,13 @@ extern "C" void free(void* addr)
if ( !IsGoodHeapPointer(addr, 1) || if ( !IsGoodHeapPointer(addr, 1) ||
!IsGoodHeapPointer(chunk, sizeof(*chunk)) ) !IsGoodHeapPointer(chunk, sizeof(*chunk)) )
{ {
error(0, 0, "attempted to free(3) non-heap pointer: 0x%zx", addr); error(0, 0, "attempted to free(3) non-heap pointer: %p", addr);
abort(); abort();
} }
if ( !chunk->IsUsed() ) if ( !chunk->IsUsed() )
{ {
error(0, 0, "attempted to free(3) area that doesn't appear to be " error(0, 0, "attempted to free(3) area that doesn't appear to be "
"allocated: 0x%zx + 0x%zx", addr); "allocated: %p + 0x%zx", chunk, chunk->size);
abort(); abort();
} }
#endif #endif

View File

@ -467,7 +467,7 @@ Try make sure the desired driver is loaded and is configured correctly.\n");
struct dispmsg_crtc_mode mode = modes[selection]; struct dispmsg_crtc_mode mode = modes[selection];
if ( !SetCurrentMode(mode) ) if ( !SetCurrentMode(mode) )
{ {
error(1, errno, "Unable to set video mode: %s", mode); error(1, errno, "Unable to set video mode: %s", StringOfCrtcMode(mode));
} }
#endif #endif
if ( 1 < argc ) if ( 1 < argc )
@ -480,7 +480,7 @@ Try make sure the desired driver is loaded and is configured correctly.\n");
waitpid(childpid, &status, 0); waitpid(childpid, &status, 0);
if ( !SetCurrentMode(prevmode) ) if ( !SetCurrentMode(prevmode) )
{ {
error(1, errno, "Unable to restore video mode: %s", prevmode); error(1, errno, "Unable to restore video mode: %s", StringOfCrtcMode(prevmode));
} }
exit(WEXITSTATUS(status)); exit(WEXITSTATUS(status));
} }

View File

@ -97,7 +97,7 @@ int main(int argc, char* argv[])
if ( arg[0] != '-' ) if ( arg[0] != '-' )
{ {
if ( found_options ) if ( found_options )
error(1, 0, "path `%s' must come before options"); error(1, 0, "path `%s' must come before options", arg);
if ( path ) if ( path )
error(1, 0, "multiple paths are not supported"); error(1, 0, "multiple paths are not supported");
path = arg; path = arg;

View File

@ -20,12 +20,13 @@
*******************************************************************************/ *******************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <string.h>
#include <errno.h> #include <errno.h>
#include <error.h> #include <error.h>
#include <signal.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int usage() int usage()
{ {
@ -52,7 +53,7 @@ int main(int argc, char* argv[])
pid_t pid = atoi(argv[i]); pid_t pid = atoi(argv[i]);
if ( kill(pid, signum) ) if ( kill(pid, signum) )
{ {
error(0, errno, "(%u)", pid); error(0, errno, "(%ji)", (intmax_t) pid);
result |= 1; result |= 1;
} }
} }