diff options
author | orivej <orivej@yandex-team.ru> | 2022-02-10 16:45:01 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:01 +0300 |
commit | 2d37894b1b037cf24231090eda8589bbb44fb6fc (patch) | |
tree | be835aa92c6248212e705f25388ebafcf84bc7a1 /contrib/libs/openssl/crypto/o_str.c | |
parent | 718c552901d703c502ccbefdfc3c9028d608b947 (diff) | |
download | ydb-2d37894b1b037cf24231090eda8589bbb44fb6fc.tar.gz |
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/openssl/crypto/o_str.c')
-rw-r--r-- | contrib/libs/openssl/crypto/o_str.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/contrib/libs/openssl/crypto/o_str.c b/contrib/libs/openssl/crypto/o_str.c index 74133f3de7..eb9f21cc0c 100644 --- a/contrib/libs/openssl/crypto/o_str.c +++ b/contrib/libs/openssl/crypto/o_str.c @@ -223,26 +223,26 @@ int openssl_strerror_r(int errnum, char *buf, size_t buflen) #if defined(_MSC_VER) && _MSC_VER>=1400 && !defined(_WIN32_WCE) return !strerror_s(buf, buflen, errnum); #elif defined(_GNU_SOURCE) - char *err; - - /* - * GNU strerror_r may not actually set buf. - * It can return a pointer to some (immutable) static string in which case - * buf is left unused. - */ - err = strerror_r(errnum, buf, buflen); - if (err == NULL || buflen == 0) - return 0; - /* - * If err is statically allocated, err != buf and we need to copy the data. - * If err points somewhere inside buf, OPENSSL_strlcpy can handle this, - * since src and dest are not annotated with __restrict and the function - * reads src byte for byte and writes to dest. - * If err == buf we do not have to copy anything. - */ - if (err != buf) - OPENSSL_strlcpy(buf, err, buflen); - return 1; + char *err; + + /* + * GNU strerror_r may not actually set buf. + * It can return a pointer to some (immutable) static string in which case + * buf is left unused. + */ + err = strerror_r(errnum, buf, buflen); + if (err == NULL || buflen == 0) + return 0; + /* + * If err is statically allocated, err != buf and we need to copy the data. + * If err points somewhere inside buf, OPENSSL_strlcpy can handle this, + * since src and dest are not annotated with __restrict and the function + * reads src byte for byte and writes to dest. + * If err == buf we do not have to copy anything. + */ + if (err != buf) + OPENSSL_strlcpy(buf, err, buflen); + return 1; #elif (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) || \ (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 600) /* @@ -253,7 +253,7 @@ int openssl_strerror_r(int errnum, char *buf, size_t buflen) return !strerror_r(errnum, buf, buflen); #else char *err; - + /* Fall back to non-thread safe strerror()...its all we can do */ if (buflen < 2) return 0; @@ -261,7 +261,7 @@ int openssl_strerror_r(int errnum, char *buf, size_t buflen) /* Can this ever happen? */ if (err == NULL) return 0; - OPENSSL_strlcpy(buf, err, buflen); + OPENSSL_strlcpy(buf, err, buflen); return 1; #endif } |