summaryrefslogtreecommitdiffstats
path: root/libc
diff options
context:
space:
mode:
authorAustin Foxley <austinf@cetoncorp.com>2009-10-17 10:25:37 -0700
committerAustin Foxley <austinf@cetoncorp.com>2009-10-17 10:25:37 -0700
commit4abe7c1ce9e466a08e3218ce1cb05191f981c284 (patch)
tree1bcc8cfd7094007abebab7ee8675022f405095bc /libc
parent3a1636dfb6d5bcd3780a4b7d655ffde241615489 (diff)
downloaduClibc-alpine-4abe7c1ce9e466a08e3218ce1cb05191f981c284.tar.bz2
uClibc-alpine-4abe7c1ce9e466a08e3218ce1cb05191f981c284.tar.xz
hostid: style fixes to match master
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
Diffstat (limited to 'libc')
-rw-r--r--libc/inet/hostid.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/libc/inet/hostid.c b/libc/inet/hostid.c
index 86be79645..c6d6204ae 100644
--- a/libc/inet/hostid.c
+++ b/libc/inet/hostid.c
@@ -25,10 +25,12 @@ int sethostid(long int new_id)
int fd;
int ret;
- if (geteuid() || getuid()) return __set_errno(EPERM);
- if ((fd=open_not_cancel(HOSTID,O_CREAT|O_WRONLY,0644))<0) return -1;
- ret = write_not_cancel(fd,(void *)&new_id,sizeof(new_id)) ==
- sizeof(new_id) ? 0 : -1;
+ if (geteuid() || getuid())
+ return __set_errno(EPERM);
+ fd = open_not_cancel(HOSTID, O_CREAT|O_WRONLY, 0644);
+ if (fd < 0)
+ return fd;
+ ret = write_not_cancel(fd, &new_id, sizeof(new_id)) == sizeof(new_id) ? 0 : -1;
close_not_cancel_no_status (fd);
return ret;
}
@@ -43,8 +45,8 @@ long int gethostid(void)
* It is not an error if we cannot read this file. It is not even an
* error if we cannot read all the bytes, we just carry on trying...
*/
- if ((fd =open_not_cancel_2 (HOSTID, O_RDONLY)) >= 0 &&
- read_not_cancel (fd, (void *) &id, sizeof (id)))
+ fd = open_not_cancel_2(HOSTID, O_RDONLY);
+ if (fd >= 0 && read_not_cancel(fd, &id, sizeof(id)))
{
close_not_cancel_no_status (fd);
return id;