]> code.ossystems Code Review - openembedded-core.git/blob
804a62731df84b05e8db1b981b99641f61035e1b
[openembedded-core.git] /
1 From: Marco Nenciarini <marco.nenciarini@devise.it>
2 Date: Wed, 27 Jan 2010 19:46:21 +0100
3 Subject: [PATCH] uuid: preserve -m option status in -v option handling
4
5 Bug: 531396
6 ---
7  uuid_cli.c |   19 ++++++++++---------
8  1 files changed, 10 insertions(+), 9 deletions(-)
9
10 ----
11 Upstream-Status: Inappropriate [not author]
12
13 This patch is from debian ossp-uuid 1.6.2 integration.
14
15 Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
16
17 diff --git a/uuid_cli.c b/uuid_cli.c
18 index d1b0b11..14a67fe 100644
19 --- a/uuid_cli.c
20 +++ b/uuid_cli.c
21 @@ -140,11 +140,12 @@ int main(int argc, char *argv[])
22                  i = strtol(optarg, &p, 10);
23                  if (*p != '\0')
24                      usage("invalid argument to option 'v'");
25 +                version &= ~(UUID_MAKE_V1|UUID_MAKE_V3|UUID_MAKE_V4|UUID_MAKE_V5);
26                  switch (i) {
27 -                    case 1: version = UUID_MAKE_V1; break;
28 -                    case 3: version = UUID_MAKE_V3; break;
29 -                    case 4: version = UUID_MAKE_V4; break;
30 -                    case 5: version = UUID_MAKE_V5; break;
31 +                    case 1: version |= UUID_MAKE_V1; break;
32 +                    case 3: version |= UUID_MAKE_V3; break;
33 +                    case 4: version |= UUID_MAKE_V4; break;
34 +                    case 5: version |= UUID_MAKE_V5; break;
35                      default:
36                          usage("invalid version on option 'v'");
37                          break;
38 @@ -213,10 +214,10 @@ int main(int argc, char *argv[])
39      }
40      else {
41          /* encoding */
42 -        if (   (version == UUID_MAKE_V1 && argc != 0)
43 -            || (version == UUID_MAKE_V3 && argc != 2)
44 -            || (version == UUID_MAKE_V4 && argc != 0)
45 -            || (version == UUID_MAKE_V5 && argc != 2))
46 +        if (   (version & UUID_MAKE_V1 && argc != 0)
47 +            || (version & UUID_MAKE_V3 && argc != 2)
48 +            || (version & UUID_MAKE_V4 && argc != 0)
49 +            || (version & UUID_MAKE_V5 && argc != 2))
50              usage("invalid number of arguments");
51          if ((rc = uuid_create(&uuid)) != UUID_RC_OK)
52              error(1, "uuid_create: %s", uuid_error(rc));
53 @@ -232,7 +233,7 @@ int main(int argc, char *argv[])
54                  if ((rc = uuid_load(uuid, "nil")) != UUID_RC_OK)
55                      error(1, "uuid_load: %s", uuid_error(rc));
56              }
57 -            if (version == UUID_MAKE_V3 || version == UUID_MAKE_V5) {
58 +            if (version & UUID_MAKE_V3 || version & UUID_MAKE_V5) {
59                  if ((rc = uuid_create(&uuid_ns)) != UUID_RC_OK)
60                      error(1, "uuid_create: %s", uuid_error(rc));
61                  if ((rc = uuid_load(uuid_ns, argv[0])) != UUID_RC_OK) {
62 --