Date: Wed, 24 Feb 2016 17:14:11 +0000 (UTC) From: "Pedro F. Giffuni" <pfg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r295975 - head/lib/libc/db/recno Message-ID: <201602241714.u1OHEBoA088760@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pfg Date: Wed Feb 24 17:14:11 2016 New Revision: 295975 URL: https://svnweb.freebsd.org/changeset/base/295975 Log: db(3): Fix aliasing warnings from modern GCC. While here also drop a malloc cast. Obtained from: NetBSD (CVS Rev. 1.18 - 1.20) Modified: head/lib/libc/db/recno/rec_put.c Modified: head/lib/libc/db/recno/rec_put.c ============================================================================== --- head/lib/libc/db/recno/rec_put.c Wed Feb 24 17:10:32 2016 (r295974) +++ head/lib/libc/db/recno/rec_put.c Wed Feb 24 17:14:11 2016 (r295975) @@ -140,8 +140,7 @@ einval: errno = EINVAL; return (RET_ERROR); if (nrec > t->bt_nrecs + 1) { if (F_ISSET(t, R_FIXLEN)) { - if ((tdata.data = - (void *)malloc(t->bt_reclen)) == NULL) + if ((tdata.data = malloc(t->bt_reclen)) == NULL) return (RET_ERROR); tdata.size = t->bt_reclen; memset(tdata.data, t->bt_bval, tdata.size); @@ -208,7 +207,7 @@ __rec_iput(BTREE *t, recno_t nrec, const return (RET_ERROR); tdata.data = db; tdata.size = NOVFLSIZE; - *(pgno_t *)db = pg; + memcpy(db, &pg, sizeof(pg)); *(u_int32_t *)(db + sizeof(pgno_t)) = data->size; dflags = P_BIGDATA; data = &tdata;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201602241714.u1OHEBoA088760>