diff options
| author | Bill Sommerfeld <wesommer@mit.edu> | 1990-01-30 15:38:53 +0000 |
|---|---|---|
| committer | Bill Sommerfeld <wesommer@mit.edu> | 1990-01-30 15:38:53 +0000 |
| commit | ac582e7d51594cc8788694a2aa18c9758aa789d4 (patch) | |
| tree | 9f73929a0e39e2f68472b62079f1f82ccfb2de01 /src/lib | |
| parent | 9b75cc76f7cbc87c0c94c560c7221837b6cc9d79 (diff) | |
| download | krb5-ac582e7d51594cc8788694a2aa18c9758aa789d4.tar.gz krb5-ac582e7d51594cc8788694a2aa18c9758aa789d4.tar.xz krb5-ac582e7d51594cc8788694a2aa18c9758aa789d4.zip | |
Avoid copying ops structure
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@198 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/krb5/ccache/file/fcc_reslv.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/lib/krb5/ccache/file/fcc_reslv.c b/src/lib/krb5/ccache/file/fcc_reslv.c index b4c2e3a5b..a0f83c676 100644 --- a/src/lib/krb5/ccache/file/fcc_reslv.c +++ b/src/lib/krb5/ccache/file/fcc_reslv.c @@ -51,36 +51,28 @@ krb5_fcc_resolve (id, residual) if (lid == NULL) return KRB5_NOMEM; - lid->ops = (krb5_cc_ops *) malloc(sizeof(krb5_cc_ops)); - if (lid->ops == NULL) { - free(lid); - return KRB5_NOMEM; - } - + lid->ops = &krb5_fcc_ops; + lid->data = (krb5_fcc_data *) malloc(sizeof(krb5_fcc_data)); if (((krb5_fcc_data *) lid->data) == NULL) { - free(lid->ops); free(lid); return KRB5_NOMEM; } ((krb5_fcc_data *) lid->data)->filename = (char *) malloc(strlen(residual) + 1); + if (((krb5_fcc_data *) lid->data)->filename == NULL) { free(((krb5_fcc_data *) lid->data)); - free(lid->ops); free(lid); return KRB5_NOMEM; } - /* Copy the virtual operation pointers into lid */ - bcopy((char *) &krb5_fcc_ops, lid->ops, sizeof(krb5_cc_ops)); - /* Set up the filename */ strcpy(((krb5_fcc_data *) lid->data)->filename, residual); - /* Make sure the file name is reserved */ - ret = open(((krb5_fcc_data *) lid->data)->filename, O_CREAT|O_EXCL,0600); + /* Make sure we can open the file name */ + ret = open(((krb5_fcc_data *) lid->data)->filename, O_CREAT|O_RDWR,0600); if (ret == -1) return errno; else { |
