poll.c: use xs*printf instead of sprintf
* poll.c: Include "xstring.h". (decode_poll_exiting): Replace sprintf with xsnprintf and xsprintf.
This commit is contained in:
parent
eb662b2aee
commit
abe89bf315
7
poll.c
7
poll.c
@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
|
#include "xstring.h"
|
||||||
|
|
||||||
#include "xlat/pollflags.h"
|
#include "xlat/pollflags.h"
|
||||||
|
|
||||||
@ -96,7 +97,9 @@ decode_poll_exiting(struct tcb *const tcp, const kernel_ulong_t pts)
|
|||||||
*outptr++ = '[';
|
*outptr++ = '[';
|
||||||
else
|
else
|
||||||
outptr = stpcpy(outptr, ", ");
|
outptr = stpcpy(outptr, ", ");
|
||||||
outptr += sprintf(outptr, "%#" PRI_klx, cur);
|
outptr += xsnprintf(outptr,
|
||||||
|
sizeof(outstr) - (outptr - outstr),
|
||||||
|
"%#" PRI_klx, cur);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!fds.revents)
|
if (!fds.revents)
|
||||||
@ -112,7 +115,7 @@ decode_poll_exiting(struct tcb *const tcp, const kernel_ulong_t pts)
|
|||||||
|
|
||||||
static const char fmt[] = "{fd=%d, revents=";
|
static const char fmt[] = "{fd=%d, revents=";
|
||||||
char fdstr[sizeof(fmt) + sizeof(int) * 3];
|
char fdstr[sizeof(fmt) + sizeof(int) * 3];
|
||||||
sprintf(fdstr, fmt, fds.fd);
|
xsprintf(fdstr, fmt, fds.fd);
|
||||||
|
|
||||||
const char *flagstr = sprintflags("", pollflags,
|
const char *flagstr = sprintflags("", pollflags,
|
||||||
(unsigned short) fds.revents);
|
(unsigned short) fds.revents);
|
||||||
|
Loading…
Reference in New Issue
Block a user