55 lines
1.5 KiB
Diff
55 lines
1.5 KiB
Diff
diff -Naur ncpfs-2.2.6.orig/sutil/ncpumount.c ncpfs-2.2.6/sutil/ncpumount.c
|
|
--- ncpfs-2.2.6.orig/sutil/ncpm_common.c 2012-08-31 11:12:54.372652698 +0400
|
|
+++ ncpfs-2.2.6/sutil/ncpm_common.c 2012-08-31 11:13:12.235236366 +0400
|
|
@@ -1446,6 +1446,7 @@
|
|
struct mntent ment;
|
|
int fd;
|
|
FILE* mtab;
|
|
+ off_t goodoffset;
|
|
|
|
if (check_name(mount_name) == -1 || check_name(mpnt) == -1)
|
|
errexit(107, _("Illegal character in mount entry\n"));
|
|
@@ -1480,14 +1481,25 @@
|
|
|
|
if ((mtab = setmntent(MOUNTED, "a+")) == NULL)
|
|
{
|
|
+ unlink(MOUNTED "~");
|
|
errexit(59, _("Can't open %s\n"), MOUNTED);
|
|
}
|
|
+ fseek (mtab, 0, SEEK_END);
|
|
+ goodoffset = ftell(mtab);
|
|
if (addmntent(mtab, &ment) == 1)
|
|
{
|
|
+ /* restore good state */
|
|
+ ftruncate(fileno(mtab), goodoffset);
|
|
+ endmntent(mtab);
|
|
+ unlink(MOUNTED "~");
|
|
errexit(60, _("Can't write mount entry\n"));
|
|
}
|
|
if (fchmod(fileno(mtab), 0644) == -1)
|
|
{
|
|
+ /* restore good state */
|
|
+ ftruncate(fileno(mtab), goodoffset);
|
|
+ endmntent(mtab);
|
|
+ unlink(MOUNTED "~");
|
|
errexit(61, _("Can't set perms on %s\n"), MOUNTED);
|
|
}
|
|
endmntent(mtab);
|
|
diff -Naur ncpfs-2.2.6.orig/sutil/ncpumount.c ncpfs-2.2.6/sutil/ncpumount.c
|
|
--- ncpfs-2.2.6.orig/sutil/ncpumount.c 2012-08-31 11:12:54.372652698 +0400
|
|
+++ ncpfs-2.2.6/sutil/ncpumount.c 2012-08-31 11:13:12.235236366 +0400
|
|
@@ -163,7 +163,12 @@
|
|
i++;
|
|
}
|
|
if (!found) {
|
|
- addmntent(new_mtab, mnt);
|
|
+ if (addmntent(new_mtab, mnt)) {
|
|
+ eprintf(_("Can't addmntent to %s: %s\n"), MOUNTED_TMP,
|
|
+ strerror(errno));
|
|
+ endmntent(mtab);
|
|
+ return 1;
|
|
+ }
|
|
}
|
|
}
|
|
|