=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/openssl/apps.c,v retrieving revision 1.29 retrieving revision 1.30 diff -c -r1.29 -r1.30 *** src/usr.bin/openssl/apps.c 2015/07/16 15:03:35 1.29 --- src/usr.bin/openssl/apps.c 2015/07/20 02:41:10 1.30 *************** *** 1,4 **** ! /* $OpenBSD: apps.c,v 1.29 2015/07/16 15:03:35 beck Exp $ */ /* * Copyright (c) 2014 Joel Sing * --- 1,4 ---- ! /* $OpenBSD: apps.c,v 1.30 2015/07/20 02:41:10 doug Exp $ */ /* * Copyright (c) 2014 Joel Sing * *************** *** 1510,1516 **** BIO_printf(bio_err, "unable to rename %s to %s\n", buf[0], serialfile); perror("reason"); ! rename(buf[1], serialfile); goto err; } return 1; --- 1510,1520 ---- BIO_printf(bio_err, "unable to rename %s to %s\n", buf[0], serialfile); perror("reason"); ! if (rename(buf[1], serialfile) < 0) { ! BIO_printf(bio_err, "unable to rename %s to %s\n", ! buf[1], serialfile); ! perror("reason"); ! } goto err; } return 1; *************** *** 1714,1720 **** BIO_printf(bio_err, "unable to rename %s to %s\n", buf[0], dbfile); perror("reason"); ! rename(buf[1], dbfile); goto err; } --- 1718,1728 ---- BIO_printf(bio_err, "unable to rename %s to %s\n", buf[0], dbfile); perror("reason"); ! if (rename(buf[1], dbfile) < 0) { ! BIO_printf(bio_err, "unable to rename %s to %s\n", ! buf[1], dbfile); ! perror("reason"); ! } goto err; } *************** *** 1723,1730 **** BIO_printf(bio_err, "unable to rename %s to %s\n", buf[4], buf[3]); perror("reason"); ! rename(dbfile, buf[0]); ! rename(buf[1], dbfile); goto err; } --- 1731,1746 ---- BIO_printf(bio_err, "unable to rename %s to %s\n", buf[4], buf[3]); perror("reason"); ! if (rename(dbfile, buf[0]) < 0) { ! BIO_printf(bio_err, "unable to rename %s to %s\n", ! dbfile, buf[0]); ! perror("reason"); ! } ! if (rename(buf[1], dbfile) < 0) { ! BIO_printf(bio_err, "unable to rename %s to %s\n", ! buf[1], dbfile); ! perror("reason"); ! } goto err; } *************** *** 1733,1741 **** BIO_printf(bio_err, "unable to rename %s to %s\n", buf[2], buf[4]); perror("reason"); ! rename(buf[3], buf[4]); ! rename(dbfile, buf[0]); ! rename(buf[1], dbfile); goto err; } return 1; --- 1749,1769 ---- BIO_printf(bio_err, "unable to rename %s to %s\n", buf[2], buf[4]); perror("reason"); ! if (rename(buf[3], buf[4]) < 0) { ! BIO_printf(bio_err, "unable to rename %s to %s\n", ! buf[3], buf[4]); ! perror("reason"); ! } ! if (rename(dbfile, buf[0]) < 0) { ! BIO_printf(bio_err, "unable to rename %s to %s\n", ! dbfile, buf[0]); ! perror("reason"); ! } ! if (rename(buf[1], dbfile) < 0) { ! BIO_printf(bio_err, "unable to rename %s to %s\n", ! buf[1], dbfile); ! perror("reason"); ! } goto err; } return 1;