Date: Sun, 19 Aug 2001 21:40:16 -0400 From: David Hill <david@phobia.ms> To: audit@freebsd.org Subject: write.c patch - WARNS=2 Message-ID: <20010819214016.298f8222.david@phobia.ms>
next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --Multipart_Sun__19_Aug_2001_21:40:16_-0400_08192c00 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Hello - Here is a write.c patch. 1. Constified 2. Changed a strncpy to a strlcpy 3. Changed S_IWRITE >> 3 to S_IWGRP 4. Code cleaup (declaration and unused variable) when WARNS=2 - David --Multipart_Sun__19_Aug_2001_21:40:16_-0400_08192c00 Content-Type: application/octet-stream; name="write.c.patch" Content-Disposition: attachment; filename="write.c.patch" Content-Transfer-Encoding: base64 ZGlmZiAtcnUgL3Vzci9zcmMvdXNyLmJpbi93cml0ZS5vcmlnL01ha2VmaWxlIC91c3Ivc3JjL3Vz ci5iaW4vd3JpdGUvTWFrZWZpbGUKLS0tIC91c3Ivc3JjL3Vzci5iaW4vd3JpdGUub3JpZy9NYWtl ZmlsZQlGcmkgQXVnIDEwIDIyOjU0OjE2IDIwMDEKKysrIC91c3Ivc3JjL3Vzci5iaW4vd3JpdGUv TWFrZWZpbGUJRnJpIEF1ZyAxMCAyMjo1NDo0NSAyMDAxCkBAIC0zLDUgKzMsNiBAQAogUFJPRz0J d3JpdGUKIEJJTk1PREU9MjU1NQogQklOR1JQPQl0dHkKK1dBUk5TPz0gMgogCiAuaW5jbHVkZSA8 YnNkLnByb2cubWs+CmRpZmYgLXJ1IC91c3Ivc3JjL3Vzci5iaW4vd3JpdGUub3JpZy93cml0ZS5j IC91c3Ivc3JjL3Vzci5iaW4vd3JpdGUvd3JpdGUuYwotLS0gL3Vzci9zcmMvdXNyLmJpbi93cml0 ZS5vcmlnL3dyaXRlLmMJRnJpIEF1ZyAxMCAyMjo1NDoxNiAyMDAxCisrKyAvdXNyL3NyYy91c3Iu YmluL3dyaXRlL3dyaXRlLmMJRnJpIEF1Z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scribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010819214016.298f8222.david>