diff options
author | Joris Vink <joris@cvs.openbsd.org> | 2005-03-29 17:37:38 +0000 |
---|---|---|
committer | Joris Vink <joris@cvs.openbsd.org> | 2005-03-29 17:37:38 +0000 |
commit | 3cda26b52e9452d4c33f0af08f873804823cb823 (patch) | |
tree | 12620aed93e2fc38435264ac6b691717920ea398 /usr.bin | |
parent | 462a9a2570a038fe270493433e285633576b25fd (diff) |
cvs_file_attach() can fail, make sure we can handle it
when it does.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/cvs/file.c | 7 | ||||
-rw-r--r-- | usr.bin/cvs/resp.c | 7 |
2 files changed, 10 insertions, 4 deletions
diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c index 3262a65171a..e5534670a6b 100644 --- a/usr.bin/cvs/file.c +++ b/usr.bin/cvs/file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: file.c,v 1.58 2005/03/26 08:09:54 tedu Exp $ */ +/* $OpenBSD: file.c,v 1.59 2005/03/29 17:37:37 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -380,7 +380,10 @@ cvs_file_getspec(char **fspec, int fsn, int flags) return (NULL); } - cvs_file_attach(cf, nf); + if (cvs_file_attach(cf, nf) < 0) { + cvs_file_free(base); + return (NULL); + } } if (np != NULL) { diff --git a/usr.bin/cvs/resp.c b/usr.bin/cvs/resp.c index 12a29d818f1..e9b86036d02 100644 --- a/usr.bin/cvs/resp.c +++ b/usr.bin/cvs/resp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: resp.c,v 1.21 2005/01/27 18:34:26 jfb Exp $ */ +/* $OpenBSD: resp.c,v 1.22 2005/03/29 17:37:37 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -394,7 +394,10 @@ cvs_resp_sticky(struct cvsroot *root, int type, char *line) cf->cf_ddat->cd_root = root; root->cr_ref++; - cvs_file_attach(sdir, cf); + if (cvs_file_attach(sdir, cf) < 0) { + cvs_file_free(cf); + return (-1); + } /* add a directory entry to the parent */ if ((entf = cvs_ent_open(subdir, O_WRONLY)) != NULL) { |