Skip to contentSkip to conversation

fs/binfmt_misc.c: let binfmt status be more readable

PATCH In review Qinghuang Feng 2 participants 2 messages Nov 17, 2008 – Nov 19, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/binfmt_misc.c: let binfmt status be more readable

The following is what it looks like before patching. It is not much readable.

user@ubuntu:/proc/sys/fs/binfmt_misc$ cat status 
enableduser@ubuntu:/proc/sys/fs/binfmt_misc$

---

fs/binfmt_misc.c +1 -1
index f2744ab..72e8b24 100644
@@ -652,7 +652,7 @@ static const struct file_operations bm_register_operations = {
 static ssize_t
 bm_status_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
 {
-	char *s = enabled ? "enabled" : "disabled";
+	char *s = enabled ? "enabled\n" : "disabled\n";
 
 	return simple_read_from_buffer(buf, nbytes, ppos, s, strlen(s));
 }
#1 lore raw
Quoted 13 lines · On Mon, 17 Nov 2008 15:38:16 +0800 Qinghuang Feng <[email protected]>…

The following is what it looks like before patching. It is not much readable.

user@ubuntu:/proc/sys/fs/binfmt_misc$ cat status 
enableduser@ubuntu:/proc/sys/fs/binfmt_misc$

---

fs/binfmt_misc.c +0 -0
index f2744ab..72e8b24 100644

fs/binfmt_misc.c static const struct file_operations bm_register_operations = { · line 658

Quoted 8 lines
fs/binfmt_misc.c +1 -1
@@ -652,7 +652,7 @@ static const struct file_operations bm_register_operations = {
 static ssize_t
 bm_status_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
 {
-	char *s = enabled ? "enabled" : "disabled";
+	char *s = enabled ? "enabled\n" : "disabled\n";
 
 	return simple_read_from_buffer(buf, nbytes, ppos, s, strlen(s));
 }

Well. That's a bugfix, really.

It fixes a bug which has been there for a very long time, in a way which is non-backward-compatible.

Are there existing applications out there which will disastrously fail if we add a newline to the /proc/sys/fs/binfmt_misc/status contents? I somehow doubt it. But we shall find out :)