Hi!
> dread_f(int opno, long r)
> {
> __int64_t align;
> - char *buf;
> + char *buf = NULL;
> struct dioattr diob;
> int e;
> pathname_t f;
> @@ -1826,7 +1826,14 @@ dread_f(int opno, long r)
> len = align;
> else if (len > diob.d_maxiosz)
> len = diob.d_maxiosz;
> - buf = memalign(diob.d_mem, len);
> + if (posix_memalign((void **)&buf, diob.d_mem, len) != 0) {
> + perror("posix_memalign");
Sorry for not spotting this earlier, but I've doublechecked the
manual page and it says:
...
posix_memalign() returns zero on success, or one of the error values
listed in the next section on failure. Note that errno is not set.
...
So you can't use perror() to print the error message. It would probably
print something like:
posix_memalign: Succeded
The correct solution is to save the return value from posix_memalign()
and use strerror().
> + exit(1);
> + }
> + if (buf == NULL) {
> + fprintf(stderr, "posix_memalign: buf is NULL\n");
> + exit(1);
> + }
> e = read(fd, buf, len) < 0 ? errno : 0;
> free(buf);
--
Cyril Hrubis
[email protected]
------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list