summaryrefslogtreecommitdiff
path: root/networking/sendmail.c
diff options
context:
space:
mode:
authorDenis Vlasenko2008-08-10 20:46:39 +0000
committerDenis Vlasenko2008-08-10 20:46:39 +0000
commit8d07560eef94262d0e156e48ea8ecf17db20e794 (patch)
tree389ac3098c7e570d987bc2aa695ded0d7bccf1f1 /networking/sendmail.c
parent63e49fa56f31aca5b62d9382e9c621307232b241 (diff)
downloadbusybox-8d07560eef94262d0e156e48ea8ecf17db20e794.zip
busybox-8d07560eef94262d0e156e48ea8ecf17db20e794.tar.gz
sendmail: work around (bogus) gcc warning
Diffstat (limited to 'networking/sendmail.c')
-rw-r--r--networking/sendmail.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/networking/sendmail.c b/networking/sendmail.c
index e6af3d4..c605d7c 100644
--- a/networking/sendmail.c
+++ b/networking/sendmail.c
@@ -255,7 +255,8 @@ static void pop3_message(const char *filename)
}
#endif
-static char *parse_url(char *url, char **user, char **pass)
+// NB: parse_url can modify url[] (despite const), but only if '@' is there
+static const char *parse_url(const char *url, const char **user, const char **pass)
{
// parse [user[:pass]@]host
// return host
@@ -284,8 +285,8 @@ int sendgetmail_main(int argc UNUSED_PARAM, char **argv)
{
llist_t *opt_attachments = NULL;
char *opt_from;
- char *opt_user;
- char *opt_pass;
+ const char *opt_user;
+ const char *opt_pass;
enum {
OPT_w = 1 << 0, // network timeout
OPT_H = 1 << 1, // [user:password@]server[:port]
@@ -344,7 +345,7 @@ int sendgetmail_main(int argc UNUSED_PARAM, char **argv)
// fetch username and password, if any
// NB: parse_url modifies opt_connect[] ONLY if '@' is there.
// Thus "127.0.0.1" won't be modified, an is ok that it is RO.
- opt_connect = parse_url((char*)opt_connect, &opt_user, &opt_pass);
+ opt_connect = parse_url(opt_connect, &opt_user, &opt_pass);
// bb_error_msg("H[%s] U[%s] P[%s]", opt_connect, opt_user, opt_pass);
// username must be defined!
@@ -405,7 +406,7 @@ int sendgetmail_main(int argc UNUSED_PARAM, char **argv)
// set sender
// NOTE: if password has not been specified
// then no authentication is possible
- code = (opt_pass) ? -1 : 250;
+ code = (opt_pass ? -1 : 250);
// first try softly without authentication
while (250 != smtp_checkp("MAIL FROM:<%s>", opt_from, code)) {
// MAIL FROM failed -> authentication needed