mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] [PATCH] make exit condition clearer in fixup_rpath
@ 2022-08-15 18:07 Érico Nogueira
  0 siblings, 0 replies; 2+ messages in thread
From: Érico Nogueira @ 2022-08-15 18:07 UTC (permalink / raw)
  To: musl; +Cc: Érico Nogueira

breaking out of the switch-case when l==-1 means the conditional below
will necessarily be true (-1 >= buf_size, a size_t variable) and the
function will return 0. it is, however, somewhat unclear that that's
what's happening. simply returning there is simpler
---
 ldso/dynlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ldso/dynlink.c b/ldso/dynlink.c
index cc677952..fb77b092 100644
--- a/ldso/dynlink.c
+++ b/ldso/dynlink.c
@@ -868,7 +868,7 @@ static int fixup_rpath(struct dso *p, char *buf, size_t buf_size)
 		case ENOENT:
 		case ENOTDIR:
 		case EACCES:
-			break;
+			return 0;
 		default:
 			return -1;
 		}
-- 
2.37.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [musl] [PATCH] make exit condition clearer in fixup_rpath
@ 2022-08-15 18:14 Érico Nogueira
  0 siblings, 0 replies; 2+ messages in thread
From: Érico Nogueira @ 2022-08-15 18:14 UTC (permalink / raw)
  To: musl; +Cc: Érico Nogueira

breaking out of the switch-case when l==-1 means the conditional below
will necessarily be true (-1 >= buf_size, a size_t variable) and the
function will return 0. it is, however, somewhat unclear that that's
what's happening. simply returning there is simpler
---
 ldso/dynlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ldso/dynlink.c b/ldso/dynlink.c
index cc677952..fb77b092 100644
--- a/ldso/dynlink.c
+++ b/ldso/dynlink.c
@@ -868,7 +868,7 @@ static int fixup_rpath(struct dso *p, char *buf, size_t buf_size)
 		case ENOENT:
 		case ENOTDIR:
 		case EACCES:
-			break;
+			return 0;
 		default:
 			return -1;
 		}
-- 
2.37.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-15 18:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-15 18:07 [musl] [PATCH] make exit condition clearer in fixup_rpath Érico Nogueira
2022-08-15 18:14 Érico Nogueira

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).