* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
+ * or https://opensource.org/licenses/CDDL-1.0.
* See the License for the specific language governing permissions
* and limitations under the License.
*
typedef struct timetest {
int type;
- char *name;
+ const char *name;
int (*func)(const char *pfile);
} timetest_t;
do_xattr(const char *pfile)
{
int ret = 0;
- char *value = "user.value";
+ const char *value = "user.value";
if (pfile == NULL) {
return (-1);
main(void)
{
int i, ret, fd;
- char *penv[] = {"TESTDIR", "TESTFILE0"};
+ const char *penv[] = {"TESTDIR", "TESTFILE0"};
(void) atexit(cleanup);
if (access(tfile, F_OK) == 0) {
(void) unlink(tfile);
}
- ret = 0;
if ((fd = open(tfile, O_WRONLY | O_CREAT | O_TRUNC, ALL_MODE)) == -1) {
(void) fprintf(stderr, "open(%s) failed: %d\n", tfile, errno);
return (1);
return (1);
}
- if (t1 == t2) {
- (void) fprintf(stderr, "%s: t1(%ld) == t2(%ld)\n",
+
+ /*
+ * Ideally, time change would be exactly two seconds, but allow
+ * a little slack in case of scheduling delays or similar.
+ */
+ long delta = (long)t2 - (long)t1;
+ if (delta < 2 || delta > 4) {
+ (void) fprintf(stderr,
+ "%s: BAD time change: t1(%ld), t2(%ld)\n",
timetest_table[i].name, (long)t1, (long)t2);
return (1);
} else {
- (void) fprintf(stderr, "%s: t1(%ld) != t2(%ld)\n",
+ (void) fprintf(stderr,
+ "%s: good time change: t1(%ld), t2(%ld)\n",
timetest_table[i].name, (long)t1, (long)t2);
}
}