ソースを参照

glynn: Describe underlying error if rename() fails
(merge https://trac.osgeo.org/grass/changeset/61048 from trunk)


git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@61115 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 11 年 前
コミット
982a54d03f
1 ファイル変更5 行追加4 行削除
  1. 5 4
      lib/raster/close.c

+ 5 - 4
lib/raster/close.c

@@ -22,6 +22,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <signal.h>
+#include <errno.h>
 
 #include <grass/gis.h>
 #include <grass/raster.h>
@@ -370,8 +371,8 @@ static int close_new(int fd, int ok)
 	if (fcb->null_cur_row > 0) {
 	    /* if temporary NULL file exists, write it into cell_misc/name/null */
 	    if (rename(fcb->null_temp_name, path)) {
-		G_warning(_("Unable to rename null file '%s' to '%s'"),
-			  fcb->null_temp_name, path);
+		G_warning(_("Unable to rename null file '%s' to '%s': %s"),
+			  fcb->null_temp_name, path, strerror(errno));
 		stat = -1;
 	    }
 	    else {
@@ -435,8 +436,8 @@ static int close_new(int fd, int ok)
 	G_file_name(path, CELL_DIR, fcb->name, fcb->mapset);
 	remove(path);
 	if (rename(fcb->temp_name, path)) {
-	    G_warning(_("Unable to rename cell file '%s' to '%s'"),
-		      fcb->temp_name, path);
+	    G_warning(_("Unable to rename cell file '%s' to '%s': %s"),
+		      fcb->temp_name, path, strerror(errno));
 	    stat = -1;
 	}
 	else {