Skip to contentSkip to conversation

minor einfo and mtd_debug improvement

PATCH Larry Doolittle 2 participants 2 messages Oct 5, 2001 – Oct 8, 2001 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

The following changes let einfo and mtd_debug do the right thing when the underlying MTD device is marked readonly.

- Larry

home/ldoolitt/cvs/mtd/util/einfo.c renamed from einfo.c +1 -1
diff -ur mtd-util-20011003/einfo.c /home/ldoolitt/cvs/mtd/util/einfo.c
@@ -20,7 +20,7 @@
 	}
    
 	// Open and size the device
-	if ((Fd = open(argv[1],O_RDONLY)) < 0)
+	if ((Fd = open(argv[1],O_RDWR)) < 0)
 	{
 		fprintf(stderr,"File open error\n");
 		return 8;
home/ldoolitt/cvs/mtd/util/mtd_debug.c renamed from mtd_debug.c +1 -3
diff -ur mtd-util-20011003/mtd_debug.c /home/ldoolitt/cvs/mtd/util/mtd_debug.c
@@ -357,7 +357,6 @@
 {
    const char *progname;
    int err = 0,fd,option = OPT_INFO;
-   int open_flag;
    (progname = strrchr (argv[0],'/')) ? progname++ : (progname = argv[0]);
 
    /* parse command-line options */
@@ -373,8 +372,7 @@
 	 showusage (progname);
 
    /* open device */
-   open_flag = (option==OPT_INFO || option==OPT_READ) ? O_RDONLY : O_RDWR;
-   if ((fd = open (argv[2],O_SYNC | open_flag)) < 0)
+   if ((fd = open (argv[2],O_SYNC | O_RDWR)) < 0)
 	 {
 		perror ("open()");
 		exit (1);
#1 lore raw
Quoted 2 lines · [email protected] said:

The following changes let einfo and mtd_debug do the right thing when
the underlying MTD device is marked readonly.

Thanks; applied. The patch was backwards - 'cvs diff -u' would have given better results.

--
dwmw2