Commit 9bce164c authored by Konstantin Khlebnikov's avatar Konstantin Khlebnikov

use posix_memalign() instead of memalign()

parent cc840e86
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <stdarg.h> #include <stdarg.h>
#include <getopt.h> #include <getopt.h>
#include <string.h> #include <string.h>
#include <malloc.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
...@@ -168,7 +167,7 @@ char *fstype = ""; ...@@ -168,7 +167,7 @@ char *fstype = "";
char *device = ""; char *device = "";
int fd; int fd;
char *buf; void *buf;
int quiet = 0; int quiet = 0;
int period = 0; int period = 0;
...@@ -372,8 +371,8 @@ int main (int argc, char **argv) ...@@ -372,8 +371,8 @@ int main (int argc, char **argv)
if (size > wsize) if (size > wsize)
errx(2, "request size is too big for this target"); errx(2, "request size is too big for this target");
buf = memalign(sysconf(_SC_PAGE_SIZE), size); ret = posix_memalign(&buf, sysconf(_SC_PAGE_SIZE), size);
if (!buf) if (ret)
errx(2, "buffer allocation failed"); errx(2, "buffer allocation failed");
memset(buf, '*', size); memset(buf, '*', size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment