Changeset: eb2f51ba0ae0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=eb2f51ba0ae0
Modified Files:
        gdk/gdk_logger.c
Branch: default
Log Message:

Use fgetpos/fsetpos.


diffs (29 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -1868,7 +1868,7 @@ logger_load(int debug, const char *fn, c
                /* Do not do conversion if logger is shared/read-only */
                if (!lg->shared) {
                        FILE *fp1;
-                       long off; /* type long required by ftell() & fseek() */
+                       fpos_t off;
                        int curid;
 
                        snprintf(cvfile, sizeof(cvfile), "%sconvert-nil-nan",
@@ -1876,12 +1876,12 @@ logger_load(int debug, const char *fn, c
                        snprintf(bak, sizeof(bak), "%s_nil-nan-convert", fn);
                        /* read the current log id without disturbing
                         * the file pointer */
-                       off = ftell(fp);
-                       if (off < 0) /* should never happen */
-                               goto error;
+                       if (fgetpos(fp, &off) != 0)
+                               goto error; /* should never happen */
                        if (fscanf(fp, "%d", &curid) != 1)
                                curid = -1; /* shouldn't happen? */
-                       fseek(fp, off, SEEK_SET);
+                       if (fsetpos(fp, &off) != 0)
+                               goto error; /* should never happen */
 
                        if ((fp1 = GDKfileopen(0, NULL, bak, NULL, "r")) != 
NULL) {
                                /* file indicating that we need to do
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to