allow 0 timestamp

This commit is contained in:
christos 2017-02-16 22:40:19 +00:00
parent d372863cc1
commit f8bc8f05cf
3 changed files with 9 additions and 7 deletions

View File

@ -80,6 +80,7 @@ gpt_t gpt_open(const char *, int, int, off_t, u_int, time_t);
#define GPT_QUIET 0x04
#define GPT_NOSYNC 0x08
#define GPT_FILE 0x10
#define GPT_TIMESTAMP 0x20
void* gpt_read(gpt_t, off_t, size_t);
off_t gpt_last(gpt_t);

View File

@ -1,4 +1,4 @@
/* $NetBSD: gpt_uuid.c,v 1.14 2017/02/16 03:32:17 christos Exp $ */
/* $NetBSD: gpt_uuid.c,v 1.15 2017/02/16 22:40:19 christos Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@ -32,7 +32,7 @@
#include <sys/cdefs.h>
#ifdef __RCSID
__RCSID("$NetBSD: gpt_uuid.c,v 1.14 2017/02/16 03:32:17 christos Exp $");
__RCSID("$NetBSD: gpt_uuid.c,v 1.15 2017/02/16 22:40:19 christos Exp $");
#endif
#include <err.h>
@ -301,10 +301,10 @@ gpt_uuid_generate(gpt_t gpt, gpt_uuid_t t)
{
int rv;
struct dce_uuid u;
if (gpt->timestamp == 0)
rv = gpt_uuid_random(gpt, &u, sizeof(u));
else
if (gpt->flags & GPT_TIMESTAMP)
rv = gpt_uuid_tstamp(gpt, &u, sizeof(u));
else
rv = gpt_uuid_random(gpt, &u, sizeof(u));
if (rv == -1)
return -1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.9 2017/02/16 03:32:17 christos Exp $ */
/* $NetBSD: main.c,v 1.10 2017/02/16 22:40:19 christos Exp $ */
/*-
* Copyright (c) 2002 Marcel Moolenaar
@ -34,7 +34,7 @@
#include <sys/cdefs.h>
#ifdef __RCSID
__RCSID("$NetBSD: main.c,v 1.9 2017/02/16 03:32:17 christos Exp $");
__RCSID("$NetBSD: main.c,v 1.10 2017/02/16 22:40:19 christos Exp $");
#endif
#include <stdio.h>
@ -206,6 +206,7 @@ main(int argc, char *argv[])
usage();
break;
case 'T':
flags |= GPT_TIMESTAMP;
timestamp = get_tstamp(optarg);
break;
case 'v':