[GRASS-SVN] r40315 - grass/trunk/lib/db/dbmi_base

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jan 8 03:48:15 EST 2010


Author: hamish
Date: 2010-01-08 03:48:15 -0500 (Fri, 08 Jan 2010)
New Revision: 40315

Modified:
   grass/trunk/lib/db/dbmi_base/login.c
Log:
use G_getl2, add FIXME comment and debug msg formatting (merge from devbr6)

Modified: grass/trunk/lib/db/dbmi_base/login.c
===================================================================
--- grass/trunk/lib/db/dbmi_base/login.c	2010-01-08 08:46:29 UTC (rev 40314)
+++ grass/trunk/lib/db/dbmi_base/login.c	2010-01-08 08:48:15 UTC (rev 40315)
@@ -88,7 +88,7 @@
     login->n = 0;
     file = login_filename();
 
-    G_debug(3, "file = %s", file);
+    G_debug(3, "file = <%s>", file);
 
     if (stat(file, &info) != 0) {
 	G_debug(3, "login file does not exist");
@@ -99,13 +99,15 @@
     if (fd == NULL)
 	return -1;
 
-    while (fgets(buf, 2000, fd)) {
+    while (G_getl2(buf, 2000, fd)) {
 	G_chop(buf);
 
 	usr[0] = pwd[0] = '\0';
+	/* FIXME: not safe for spaces in DB path name */
 	ret = sscanf(buf, "%[^ ] %[^ ] %[^ ] %[^ ]", dr, db, usr, pwd);
 
-	G_debug(3, "ret = %d : %s %s %s %s", ret, dr, db, usr, pwd);
+	G_debug(3, "ret = %d : dr=[%s] db=[%s] us=[%s] pw=[%s]",
+		ret, dr, db, usr, pwd);
 
 	if (ret < 2) {
 	    G_warning(_("Login file corrupted"));



More information about the grass-commit mailing list