CVS commit: [netbsd-6] src/sys/compat/common

2016-08-27 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Aug 27 14:51:29 UTC 2016

Modified Files:
src/sys/compat/common [netbsd-6]: vfs_syscalls_43.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1400):
sys/compat/common/vfs_syscalls_43.c: revision 1.58
fill in the tv_nsec parts of the converted timespec in cvtstat().


To generate a diff of this commit:
cvs rdiff -u -r1.54.14.1 -r1.54.14.2 src/sys/compat/common/vfs_syscalls_43.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/vfs_syscalls_43.c
diff -u src/sys/compat/common/vfs_syscalls_43.c:1.54.14.1 src/sys/compat/common/vfs_syscalls_43.c:1.54.14.2
--- src/sys/compat/common/vfs_syscalls_43.c:1.54.14.1	Thu Mar 14 16:33:09 2013
+++ src/sys/compat/common/vfs_syscalls_43.c	Sat Aug 27 14:51:29 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_43.c,v 1.54.14.1 2013/03/14 16:33:09 riz Exp $	*/
+/*	$NetBSD: vfs_syscalls_43.c,v 1.54.14.2 2016/08/27 14:51:29 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.54.14.1 2013/03/14 16:33:09 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.54.14.2 2016/08/27 14:51:29 bouyer Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -74,15 +74,42 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls
 #include 
 #include 
 
+static void cvttimespec(struct timespec *, struct timespec50 *);
 static void cvtstat(struct stat *, struct stat43 *);
 
 /*
+ * Convert from an old to a new timespec structure.
+ */
+static void
+cvttimespec(struct timespec *ts, struct timespec50 *ots)
+{
+
+	if (ts->tv_sec > INT_MAX) {
+#if defined(DEBUG) || 1
+		static bool first = true;
+
+		if (first) {
+			first = false;
+			printf("%s[%s:%d]: time_t does not fit\n",
+			__func__, curlwp->l_proc->p_comm,
+			curlwp->l_lid);
+		}
+#endif
+		ots->tv_sec = INT_MAX;
+	} else
+		ots->tv_sec = ts->tv_sec;
+	ots->tv_nsec = ts->tv_nsec;
+}
+
+/*
  * Convert from an old to a new stat structure.
  */
 static void
 cvtstat(struct stat *st, struct stat43 *ost)
 {
 
+	/* Handle any padding. */
+	memset(ost, 0, sizeof *ost);
 	ost->st_dev = st->st_dev;
 	ost->st_ino = st->st_ino;
 	ost->st_mode = st->st_mode & 0x;
@@ -94,9 +121,9 @@ cvtstat(struct stat *st, struct stat43 *
 		ost->st_size = st->st_size;
 	else
 		ost->st_size = -2;
-	ost->st_atime = st->st_atime;
-	ost->st_mtime = st->st_mtime;
-	ost->st_ctime = st->st_ctime;
+	cvttimespec(>st_atimespec, >st_atimespec);
+	cvttimespec(>st_mtimespec, >st_mtimespec);
+	cvttimespec(>st_ctimespec, >st_ctimespec);
 	ost->st_blksize = st->st_blksize;
 	ost->st_blocks = st->st_blocks;
 	ost->st_flags = st->st_flags;



CVS commit: [netbsd-6] src/sys/compat/common

2013-12-17 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Dec 17 20:52:10 UTC 2013

Modified Files:
src/sys/compat/common [netbsd-6]: compat_util.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #999):
sys/compat/common/compat_util.c: revision 1.45
Free pathbuf in an error path.
From Maxime Villard.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.44.14.1 src/sys/compat/common/compat_util.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/compat_util.c
diff -u src/sys/compat/common/compat_util.c:1.44 src/sys/compat/common/compat_util.c:1.44.14.1
--- src/sys/compat/common/compat_util.c:1.44	Fri Nov 19 06:44:35 2010
+++ src/sys/compat/common/compat_util.c	Tue Dec 17 20:52:10 2013
@@ -1,4 +1,4 @@
-/* 	$NetBSD: compat_util.c,v 1.44 2010/11/19 06:44:35 dholland Exp $	*/
+/* 	$NetBSD: compat_util.c,v 1.44.14.1 2013/12/17 20:52:10 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1994 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: compat_util.c,v 1.44 2010/11/19 06:44:35 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: compat_util.c,v 1.44.14.1 2013/12/17 20:52:10 bouyer Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -139,6 +139,7 @@ emul_find_interp(struct lwp *l, struct e
 	error = namei(nd);
 	if (error != 0) {
 		epp-ep_interp = NULL;
+		pathbuf_destroy(pb);
 		return error;
 	}