diff options
author | Sasikantha babu <sasikanth.v19@gmail.com> | 2012-05-31 19:26:07 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-31 20:49:26 -0400 |
commit | 499eea6bf9c06df3bf4549954aee6fb3427946ed (patch) | |
tree | bdd7c4be7ac845e0511c6b36f91245105ed8fdcf /kernel | |
parent | 5401cf3fac92b35415c1d011e9866a90b8bed88f (diff) |
sethostname/setdomainname: notify userspace when there is a change in uts_kern_table
sethostname() and setdomainname() notify userspace on failure (without
modifying uts_kern_table). Change things so that we only notify userspace
on success, when uts_kern_table was actually modified.
Signed-off-by: Sasikantha babu <sasikanth.v19@gmail.com>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: WANG Cong <amwang@redhat.com>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/sys.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/sys.c b/kernel/sys.c index 6df42624e454..8b71cef3bf1a 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
@@ -1378,8 +1378,8 @@ SYSCALL_DEFINE2(sethostname, char __user *, name, int, len) | |||
1378 | memcpy(u->nodename, tmp, len); | 1378 | memcpy(u->nodename, tmp, len); |
1379 | memset(u->nodename + len, 0, sizeof(u->nodename) - len); | 1379 | memset(u->nodename + len, 0, sizeof(u->nodename) - len); |
1380 | errno = 0; | 1380 | errno = 0; |
1381 | uts_proc_notify(UTS_PROC_HOSTNAME); | ||
1381 | } | 1382 | } |
1382 | uts_proc_notify(UTS_PROC_HOSTNAME); | ||
1383 | up_write(&uts_sem); | 1383 | up_write(&uts_sem); |
1384 | return errno; | 1384 | return errno; |
1385 | } | 1385 | } |
@@ -1429,8 +1429,8 @@ SYSCALL_DEFINE2(setdomainname, char __user *, name, int, len) | |||
1429 | memcpy(u->domainname, tmp, len); | 1429 | memcpy(u->domainname, tmp, len); |
1430 | memset(u->domainname + len, 0, sizeof(u->domainname) - len); | 1430 | memset(u->domainname + len, 0, sizeof(u->domainname) - len); |
1431 | errno = 0; | 1431 | errno = 0; |
1432 | uts_proc_notify(UTS_PROC_DOMAINNAME); | ||
1432 | } | 1433 | } |
1433 | uts_proc_notify(UTS_PROC_DOMAINNAME); | ||
1434 | up_write(&uts_sem); | 1434 | up_write(&uts_sem); |
1435 | return errno; | 1435 | return errno; |
1436 | } | 1436 | } |