diff options
author | deraadt <> | 2019-06-28 13:35:02 +0000 |
---|---|---|
committer | deraadt <> | 2019-06-28 13:35:02 +0000 |
commit | 6585927e66d9ab172754d95c4296dd4309a40512 (patch) | |
tree | bc969c069c7b769f2601db17f08bec99274202a5 /src/usr.bin/openssl/apps.c | |
parent | 74ff76124ba7a371400a9f60d5e33192a3732f03 (diff) | |
download | openbsd-6585927e66d9ab172754d95c4296dd4309a40512.tar.gz openbsd-6585927e66d9ab172754d95c4296dd4309a40512.tar.bz2 openbsd-6585927e66d9ab172754d95c4296dd4309a40512.zip |
When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.
Diffstat (limited to '')
-rw-r--r-- | src/usr.bin/openssl/apps.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/usr.bin/openssl/apps.c b/src/usr.bin/openssl/apps.c index 2297b5bf2b..47e21265af 100644 --- a/src/usr.bin/openssl/apps.c +++ b/src/usr.bin/openssl/apps.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: apps.c,v 1.51 2019/02/09 15:49:21 inoguchi Exp $ */ | 1 | /* $OpenBSD: apps.c,v 1.52 2019/06/28 13:35:02 deraadt Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -1377,7 +1377,7 @@ rotate_serial(char *serialfile, char *new_suffix, char *old_suffix) | |||
1377 | goto err; | 1377 | goto err; |
1378 | } | 1378 | } |
1379 | 1379 | ||
1380 | if (rename(serialfile, opath) < 0 && | 1380 | if (rename(serialfile, opath) == -1 && |
1381 | errno != ENOENT && errno != ENOTDIR) { | 1381 | errno != ENOENT && errno != ENOTDIR) { |
1382 | BIO_printf(bio_err, "unable to rename %s to %s\n", | 1382 | BIO_printf(bio_err, "unable to rename %s to %s\n", |
1383 | serialfile, opath); | 1383 | serialfile, opath); |
@@ -1386,11 +1386,11 @@ rotate_serial(char *serialfile, char *new_suffix, char *old_suffix) | |||
1386 | } | 1386 | } |
1387 | 1387 | ||
1388 | 1388 | ||
1389 | if (rename(npath, serialfile) < 0) { | 1389 | if (rename(npath, serialfile) == -1) { |
1390 | BIO_printf(bio_err, "unable to rename %s to %s\n", | 1390 | BIO_printf(bio_err, "unable to rename %s to %s\n", |
1391 | npath, serialfile); | 1391 | npath, serialfile); |
1392 | perror("reason"); | 1392 | perror("reason"); |
1393 | if (rename(opath, serialfile) < 0) { | 1393 | if (rename(opath, serialfile) == -1) { |
1394 | BIO_printf(bio_err, "unable to rename %s to %s\n", | 1394 | BIO_printf(bio_err, "unable to rename %s to %s\n", |
1395 | opath, serialfile); | 1395 | opath, serialfile); |
1396 | perror("reason"); | 1396 | perror("reason"); |
@@ -1599,18 +1599,18 @@ rotate_index(const char *dbfile, const char *new_suffix, const char *old_suffix) | |||
1599 | goto err; | 1599 | goto err; |
1600 | } | 1600 | } |
1601 | 1601 | ||
1602 | if (rename(dbfile, odbpath) < 0 && errno != ENOENT && errno != ENOTDIR) { | 1602 | if (rename(dbfile, odbpath) == -1 && errno != ENOENT && errno != ENOTDIR) { |
1603 | BIO_printf(bio_err, "unable to rename %s to %s\n", | 1603 | BIO_printf(bio_err, "unable to rename %s to %s\n", |
1604 | dbfile, odbpath); | 1604 | dbfile, odbpath); |
1605 | perror("reason"); | 1605 | perror("reason"); |
1606 | goto err; | 1606 | goto err; |
1607 | } | 1607 | } |
1608 | 1608 | ||
1609 | if (rename(dbpath, dbfile) < 0) { | 1609 | if (rename(dbpath, dbfile) == -1) { |
1610 | BIO_printf(bio_err, "unable to rename %s to %s\n", | 1610 | BIO_printf(bio_err, "unable to rename %s to %s\n", |
1611 | dbpath, dbfile); | 1611 | dbpath, dbfile); |
1612 | perror("reason"); | 1612 | perror("reason"); |
1613 | if (rename(odbpath, dbfile) < 0) { | 1613 | if (rename(odbpath, dbfile) == -1) { |
1614 | BIO_printf(bio_err, "unable to rename %s to %s\n", | 1614 | BIO_printf(bio_err, "unable to rename %s to %s\n", |
1615 | odbpath, dbfile); | 1615 | odbpath, dbfile); |
1616 | perror("reason"); | 1616 | perror("reason"); |
@@ -1618,16 +1618,16 @@ rotate_index(const char *dbfile, const char *new_suffix, const char *old_suffix) | |||
1618 | goto err; | 1618 | goto err; |
1619 | } | 1619 | } |
1620 | 1620 | ||
1621 | if (rename(attrpath, oattrpath) < 0 && errno != ENOENT && errno != ENOTDIR) { | 1621 | if (rename(attrpath, oattrpath) == -1 && errno != ENOENT && errno != ENOTDIR) { |
1622 | BIO_printf(bio_err, "unable to rename %s to %s\n", | 1622 | BIO_printf(bio_err, "unable to rename %s to %s\n", |
1623 | attrpath, oattrpath); | 1623 | attrpath, oattrpath); |
1624 | perror("reason"); | 1624 | perror("reason"); |
1625 | if (rename(dbfile, dbpath) < 0) { | 1625 | if (rename(dbfile, dbpath) == -1) { |
1626 | BIO_printf(bio_err, "unable to rename %s to %s\n", | 1626 | BIO_printf(bio_err, "unable to rename %s to %s\n", |
1627 | dbfile, dbpath); | 1627 | dbfile, dbpath); |
1628 | perror("reason"); | 1628 | perror("reason"); |
1629 | } | 1629 | } |
1630 | if (rename(odbpath, dbfile) < 0) { | 1630 | if (rename(odbpath, dbfile) == -1) { |
1631 | BIO_printf(bio_err, "unable to rename %s to %s\n", | 1631 | BIO_printf(bio_err, "unable to rename %s to %s\n", |
1632 | odbpath, dbfile); | 1632 | odbpath, dbfile); |
1633 | perror("reason"); | 1633 | perror("reason"); |
@@ -1635,21 +1635,21 @@ rotate_index(const char *dbfile, const char *new_suffix, const char *old_suffix) | |||
1635 | goto err; | 1635 | goto err; |
1636 | } | 1636 | } |
1637 | 1637 | ||
1638 | if (rename(nattrpath, attrpath) < 0) { | 1638 | if (rename(nattrpath, attrpath) == -1) { |
1639 | BIO_printf(bio_err, "unable to rename %s to %s\n", | 1639 | BIO_printf(bio_err, "unable to rename %s to %s\n", |
1640 | nattrpath, attrpath); | 1640 | nattrpath, attrpath); |
1641 | perror("reason"); | 1641 | perror("reason"); |
1642 | if (rename(oattrpath, attrpath) < 0) { | 1642 | if (rename(oattrpath, attrpath) == -1) { |
1643 | BIO_printf(bio_err, "unable to rename %s to %s\n", | 1643 | BIO_printf(bio_err, "unable to rename %s to %s\n", |
1644 | oattrpath, attrpath); | 1644 | oattrpath, attrpath); |
1645 | perror("reason"); | 1645 | perror("reason"); |
1646 | } | 1646 | } |
1647 | if (rename(dbfile, dbpath) < 0) { | 1647 | if (rename(dbfile, dbpath) == -1) { |
1648 | BIO_printf(bio_err, "unable to rename %s to %s\n", | 1648 | BIO_printf(bio_err, "unable to rename %s to %s\n", |
1649 | dbfile, dbpath); | 1649 | dbfile, dbpath); |
1650 | perror("reason"); | 1650 | perror("reason"); |
1651 | } | 1651 | } |
1652 | if (rename(odbpath, dbfile) < 0) { | 1652 | if (rename(odbpath, dbfile) == -1) { |
1653 | BIO_printf(bio_err, "unable to rename %s to %s\n", | 1653 | BIO_printf(bio_err, "unable to rename %s to %s\n", |
1654 | odbpath, dbfile); | 1654 | odbpath, dbfile); |
1655 | perror("reason"); | 1655 | perror("reason"); |