Changeset 4133e34


Ignore:
Timestamp:
Mar 17, 2010, 10:36:59 PM (10 years ago)
Author:
Nelson Elhage <nelhage@ksplice.com>
Branches:
master, release-1.6, release-1.7, release-1.8, release-1.9
Children:
f7f35c0
Parents:
a08bfc3
git-author:
Nelson Elhage <nelhage@mit.edu> (04/13/09 19:22:27)
git-committer:
Nelson Elhage <nelhage@ksplice.com> (03/17/10 22:36:59)
Message:
zcrypt: Improve error handling behavior slightly.

* Don't print usage if we have valid usage, but couldn't find a key.
* Exit with an appropriate exit code
File:
1 edited

Legend:

Unmodified
Added
Removed
  • zcrypt.c

    ra08bfc3 r4133e34  
    208208    fname = GetZephyrVarKeyFile(argv[0], class, instance);
    209209 
    210   if (error || fname == NULL)
     210  if (error)
    211211  {
    212212    fprintf(stderr, "Usage: %s [-Z|-D|-E|-R|-S] [-F Keyfile] [-c class] [-i instance]\n", argv[0]);
    213213    fprintf(stderr, "       [-advqtluon] [-s signature] [-f arg] [-m message]\n");
    214214    fprintf(stderr, "  One or more of class, instance, and keyfile must be specified.\n");
     215    exit(1);
     216  }
     217  else if(!fname)
     218  {
     219    exit(1);
    215220  }
    216221  else
     
    257262          fprintf(stderr, "Error writing to key file.\n");
    258263          fclose(fkey);
     264          exit(1);
    259265        }
    260266        else
     
    269275      /* Encrypt/decrypt */
    270276      FILE *fkey = fopen(fname, "r");
    271       if (!fkey)
     277      if (!fkey) {
    272278        fprintf(stderr, "Could not open key file: %s\n", fname);
     279        exit(1);
     280      }
    273281      else
    274282      {
Note: See TracChangeset for help on using the changeset viewer.