]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
incindexfile: simplify code
authorBaptiste Daroussin <bapt@FreeBSD.org>
Thu, 10 Nov 2022 17:01:12 +0000 (18:01 +0100)
committerBaptiste Daroussin <bapt@FreeBSD.org>
Thu, 10 Nov 2022 17:04:28 +0000 (18:04 +0100)
src/incindexfile.c

index be1d42aa96bc72862ece7366ec03cce607450197..96d3798f9a2038fcc29a5a622f2decc69689114f 100644 (file)
@@ -75,10 +75,9 @@ int incindexfile(const char *listdir)
                }
        }
        index++;
-       lseek(fd, 0, SEEK_SET);
-       fdclose(fp, NULL);
-       dprintf(fd, "%d", index);
-       close(fd); /* Lock is also released */
+       rewind(fp);
+       fprintf(fd, "%d", index);
+       fclose(fp); /* Lock is also released */
        free(indexfilename);
 
        return index;