diff options
author | Davi Arnaut <davi.arnaut@oracle.com> | 2010-10-07 21:53:00 -0300 |
---|---|---|
committer | Davi Arnaut <davi.arnaut@oracle.com> | 2010-10-07 21:53:00 -0300 |
commit | 96c99602d4ef2b67b15ec5fb5676ad1a45e9a805 (patch) | |
tree | d5c8418a06d85be40ca7ede3cdcaf10e785a0700 /plugin | |
parent | ea4c11f923b570624e541dfece9767d4551fdc81 (diff) | |
download | mariadb-git-96c99602d4ef2b67b15ec5fb5676ad1a45e9a805.tar.gz |
Bug#45288: pb2 returns a lot of compilation warnings on linux
Fix warnings related to the use of the deprecated gets() function
and passing NULL to non-pointer argument of the sys_var constructor.
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/auth/dialog.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/plugin/auth/dialog.c b/plugin/auth/dialog.c index b7c65b3d601..54f88dd9b4e 100644 --- a/plugin/auth/dialog.c +++ b/plugin/auth/dialog.c @@ -1,15 +1,15 @@ /* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -181,7 +181,7 @@ mysql_declare_plugin_end; To support all this variety, the dialog plugin has a callback function "authentication_dialog_ask". If the client has a function of this name dialog plugin will use it for communication with the user. Otherwise - a default gets() based implementation will be used. + a default fgets() based implementation will be used. */ /** @@ -208,12 +208,15 @@ static mysql_authentication_dialog_ask_t ask; static char *builtin_ask(MYSQL *mysql __attribute__((unused)), int type __attribute__((unused)), const char *prompt, - char *buf, int buf_len __attribute__((unused))) + char *buf, int buf_len) { + char *ptr; fputs(prompt, stdout); fputc(' ', stdout); - if (gets(buf) == 0) - return 0; + if (fgets(buf, buf_len, stdin) == NULL) + return NULL; + if ((ptr= strchr(buf, '\n'))) + *ptr= 0; return buf; } |