[GRASS-SVN] r40314 - grass/branches/develbranch_6/lib/db/dbmi_base

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jan 8 03:46:33 EST 2010


Author: hamish
Date: 2010-01-08 03:46:29 -0500 (Fri, 08 Jan 2010)
New Revision: 40314

Modified:
   grass/branches/develbranch_6/lib/db/dbmi_base/login.c
Log:
use G_getl2, add FIXME comment and debug msg formatting

Modified: grass/branches/develbranch_6/lib/db/dbmi_base/login.c
===================================================================
--- grass/branches/develbranch_6/lib/db/dbmi_base/login.c	2010-01-08 08:36:30 UTC (rev 40313)
+++ grass/branches/develbranch_6/lib/db/dbmi_base/login.c	2010-01-08 08:46:29 UTC (rev 40314)
@@ -73,7 +73,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");
@@ -84,13 +84,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