[GRASS-SVN] r59315 - grass/trunk/lib/db/dbmi_base
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Mar 24 11:22:52 PDT 2014
Author: martinl
Date: 2014-03-24 11:22:51 -0700 (Mon, 24 Mar 2014)
New Revision: 59315
Modified:
grass/trunk/lib/db/dbmi_base/login.c
Log:
db_set_login(): report message on failure
Modified: grass/trunk/lib/db/dbmi_base/login.c
===================================================================
--- grass/trunk/lib/db/dbmi_base/login.c 2014-03-24 18:12:00 UTC (rev 59314)
+++ grass/trunk/lib/db/dbmi_base/login.c 2014-03-24 18:22:51 UTC (rev 59315)
@@ -3,7 +3,7 @@
\brief DBMI Library (base) - login settings
- (C) 1999-2009 by the GRASS Development Team
+ (C) 1999-2014 by the GRASS Development Team
This program is free software under the GNU General Public
License (>=v2). Read the file COPYING that comes with GRASS
@@ -87,7 +87,7 @@
login->n = 0;
file = login_filename();
- G_debug(3, "DB login file = <%s>", file);
+ G_debug(3, "read_file(): DB login file = <%s>", file);
if (access(file, F_OK) != 0) {
G_debug(3, "login file does not exist");
@@ -95,8 +95,10 @@
}
fd = fopen(file, "r");
- if (fd == NULL)
+ if (fd == NULL) {
+ G_warning(_("Unable to read file '%s'"), file);
return -1;
+ }
while (G_getl2(buf, 2000, fd)) {
G_chop(buf);
@@ -108,7 +110,7 @@
ret, dr, db, usr, pwd);
if (ret < 2) {
- G_warning(_("Login file corrupted"));
+ G_warning(_("Login file (%s) corrupted (line: %s)"), file, buf);
continue;
}
@@ -133,11 +135,13 @@
file = login_filename();
- G_debug(3, "DB login file = <%s>", file);
+ G_debug(3, "write_file(): DB login file = <%s>", file);
fd = fopen(file, "w");
- if (fd == NULL)
+ if (fd == NULL) {
+ G_warning(_("Unable to write file '%s'"), file);
return -1;
+ }
/* fchmod is not available on Windows */
/* fchmod ( fileno(fd), S_IRUSR | S_IWUSR ); */
More information about the grass-commit
mailing list