PERFORCE change 199872 for review
Pawel Jakub Dawidek
pjd at FreeBSD.org
Fri Oct 7 22:12:03 UTC 2011
http://p4web.freebsd.org/@@199872?ac=10
Change 199872 by pjd at pjd_anger on 2011/10/07 22:11:45
- When creating a file, don't give group access before setting
proper group ownership.
- Add XXX comment, as creating a file and opening it for reading
only looks strange.
Affected files ...
.. //depot/projects/trustedbsd/openbsm/libauditd/auditd_lib.c#15 edit
Differences ...
==== //depot/projects/trustedbsd/openbsm/libauditd/auditd_lib.c#15 (text+ko) ====
@@ -26,7 +26,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- * $P4: //depot/projects/trustedbsd/openbsm/libauditd/auditd_lib.c#14 $
+ * $P4: //depot/projects/trustedbsd/openbsm/libauditd/auditd_lib.c#15 $
*/
#include <sys/param.h>
@@ -783,10 +783,11 @@
{
int error, fd;
- fd = open(fname, O_RDONLY | O_CREAT, S_IRUSR | S_IRGRP);
+ /* XXXPJD: We create a file and open it only for reading? Strange. */
+ fd = open(fname, O_RDONLY | O_CREAT, S_IRUSR);
if (fd < 0)
return (-1);
- if (fchown(fd, -1, gid) < 0) {
+ if (fchown(fd, -1, gid) < 0 || fchmod(fd, S_IRUSR | S_IRGRP) < 0) {
error = errno;
close(fd);
(void)unlink(fname);
More information about the p4-projects
mailing list