--- module-init-tools-3.11.1/depmod.c.bak 2010-04-02 17:35:07.497577025 +0300 +++ module-init-tools-3.11.1/depmod.c 2010-04-02 17:37:43.108577587 +0300 @@ -1662,7 +1662,15 @@ int main(int argc, char *argv[]) res = d->func(list, out, dirname); if (doing_stdout) continue; - fclose(out); + if (fflush(out) == EOF) + fatal("Could not write to %s: %s\n", + tmpname, strerror(errno)); + if (fsync(fileno(out)) == -1) + fatal("Could not write to %s: %s\n", + tmpname, strerror(errno)); + if (fclose(out) == EOF) + fatal("Could not fclose %s: %s\n", + tmpname, strerror(errno)); if (res) { if (rename(tmpname, depname) < 0) fatal("Could not rename %s into %s: %s\n",