[elinks-dev] [PATCH] smb.c: fix gcc warnings (asprintf)

Alexey Tourbin at at altlinux.ru
Tue Feb 27 03:36:51 MST 2007


---
 src/protocol/smb/smb.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/protocol/smb/smb.c b/src/protocol/smb/smb.c
index 62550e3..a7cc0dc 100644
--- a/src/protocol/smb/smb.c
+++ b/src/protocol/smb/smb.c
@@ -627,8 +627,12 @@ smb_protocol_handler(struct connection *conn)
 
 		if (*share) {
 			/* Construct service path. */
-			asprintf((char **) &v[n++], "//%.*s/%s",
+			int rv = asprintf((char **) &v[n++], "//%.*s/%s",
 				 uri->hostlen, uri->host, share);
+			if (rv < 1) {
+				perror("asprintf");
+				_exit(1);
+			}
 
 			/* Add password if any. */
 			if (uri->passwordlen && !uri->userlen) {
@@ -658,9 +662,13 @@ smb_protocol_handler(struct connection *conn)
 				v[n++] = memacpy(uri->user, uri->userlen);
 			} else {
 				/* With password. */
-				asprintf((char **) &v[n++], "%.*s%%%.*s",
+				int rv = asprintf((char **) &v[n++], "%.*s%%%.*s",
 					 uri->userlen, uri->user,
 					 uri->passwordlen, uri->password);
+				if (rv < 1) {
+					perror("asprintf");
+					_exit(1);
+				}
 			}
 		}
 
-- 
1.5.0.1.GIT



More information about the elinks-dev mailing list