summaryrefslogtreecommitdiffstats
path: root/sys-apps/mkinitrd/files/nash-ds-remount.patch
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2019-09-01 00:00:32 +0200
committerSuren A. Chilingaryan <csa@suren.me>2019-09-01 00:00:32 +0200
commitca9627e70852f6b2e835660df870fe3ab405882d (patch)
tree0a008b1d5b16fa0679a195ed7b5662c7891f591c /sys-apps/mkinitrd/files/nash-ds-remount.patch
downloaddarklin4-ca9627e70852f6b2e835660df870fe3ab405882d.tar.gz
darklin4-ca9627e70852f6b2e835660df870fe3ab405882d.tar.bz2
darklin4-ca9627e70852f6b2e835660df870fe3ab405882d.tar.xz
darklin4-ca9627e70852f6b2e835660df870fe3ab405882d.zip
Initial import
Diffstat (limited to 'sys-apps/mkinitrd/files/nash-ds-remount.patch')
-rw-r--r--sys-apps/mkinitrd/files/nash-ds-remount.patch85
1 files changed, 85 insertions, 0 deletions
diff --git a/sys-apps/mkinitrd/files/nash-ds-remount.patch b/sys-apps/mkinitrd/files/nash-ds-remount.patch
new file mode 100644
index 0000000..c403535
--- /dev/null
+++ b/sys-apps/mkinitrd/files/nash-ds-remount.patch
@@ -0,0 +1,85 @@
+diff -dPNur nash/.cvsignore nash-new/.cvsignore
+--- nash/.cvsignore 2002-06-24 04:33:33.000000000 +0500
++++ nash-new/.cvsignore 1970-01-01 04:00:00.000000000 +0400
+@@ -1 +0,0 @@
+-nash
+diff -dPNur nash/nash.c nash-new/nash.c
+--- nash/nash.c 2005-06-24 20:41:11.000000000 +0500
++++ nash-new/nash.c 2006-05-20 16:33:47.000000000 +0500
+@@ -44,6 +44,7 @@
+ #include <sys/ioctl.h>
+ #include <sys/reboot.h>
+ #include <termios.h>
++#include <mntent.h>
+
+ #include <asm/unistd.h>
+
+@@ -272,6 +273,8 @@
+ int rc = 0;
+ int flags = MS_MGC_VAL;
+ char * newOpts;
++ char *fsTypeSpace;
++ char *deviceSpace;
+
+ cmd = getArg(cmd, end, &device);
+ if (!cmd) {
+@@ -307,15 +310,9 @@
+ }
+
+ if (!(cmd = getArg(cmd, end, &mntPoint))) {
+- printf("mount: missing mount point\n");
+- return 1;
+- }
+-
+- if (!fsType) {
+- printf("mount: filesystem type expected\n");
+- return 1;
+- }
+-
++ mntPoint = device;
++ device = NULL;
++ } else
+ if (cmd < end) {
+ printf("mount: unexpected arguments\n");
+ return 1;
+@@ -382,6 +379,40 @@
+ options = newOpts;
+ }
+
++ if (((!device)||(!fsType))&&(flags&MS_REMOUNT)) {
++ FILE *mounts;
++ struct mntent *record;
++
++ mounts = setmntent("/proc/mounts", "r");
++ if (mounts) {
++ while ((record = getmntent(mounts)) != NULL) {
++ if (!strcmp(record->mnt_dir, mntPoint)) {
++ deviceSpace = alloca(strlen(record->mnt_fsname)+1);
++ fsTypeSpace = alloca(strlen(record->mnt_type)+1);
++ if ((!deviceSpace)||(!fsTypeSpace)) break;
++ strcpy(deviceSpace, record->mnt_fsname);
++ strcpy(fsTypeSpace, record->mnt_type);
++ device = deviceSpace;
++ fsType = fsTypeSpace;
++ break;
++ }
++ }
++
++ endmntent(mounts);
++ }
++ }
++
++ if (!device) {
++ printf("mount: missing mount point\n");
++ return 1;
++ }
++
++ if (!fsType) {
++ printf("mount: filesystem type expected\n");
++ return 1;
++ }
++
++
+ if (!strncmp("LABEL=", device, 6)) {
+ int major, minor;
+ char * devName;