changeset 32376:0997281a39ca

Simplify code for writing to /proc/mtrr.
author reimar
date Sat, 09 Oct 2010 12:07:49 +0000
parents cbf877922fee
children 8b160dad46ab
files vidix/mtrr.c
diffstat 1 files changed, 2 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/vidix/mtrr.c	Sat Oct 09 11:45:45 2010 +0000
+++ b/vidix/mtrr.c	Sat Oct 09 12:07:49 2010 +0000
@@ -54,13 +54,9 @@
     mtrr_fd = fopen("/proc/mtrr","wt");
     if(mtrr_fd)
     {
-	char sout[256];
-	unsigned wr_len;
-	sprintf(sout,"base=0x%08X size=0x%08X type=%s\n",base,size,stype);
-	wr_len = fprintf(mtrr_fd,sout);
-	/*printf("MTRR: %s\n",sout);*/
+	int wr_len = fprintf(mtrr_fd, "base=0x%08X size=0x%08X type=%s\n", base, size, stype);
 	fclose(mtrr_fd);
-	return wr_len == strlen(sout) ? 0 : EPERM;
+	return wr_len > 0 ? 0 : EPERM;
     }
     return ENOSYS;
 #elif defined (__i386__ ) && defined (__NetBSD__) && __NetBSD_Version__ > 105240000