summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2009-12-07 13:58:42 -0800
committerAlan Coopersmith <alan.coopersmith@sun.com>2009-12-07 13:58:42 -0800
commite6a6332e9fa68a80adb6f22ba77b58514d3d247f (patch)
tree0204fb3eae699dc1fa36ff2d88d4adde71885f62
parent6c73da6848e8b54de722490e71f9e7700ad88898 (diff)
Print more useful error messages on failures
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
-rw-r--r--constype.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/constype.c b/constype.c
index 9d68a43..eccb45d 100644
--- a/constype.c
+++ b/constype.c
@@ -46,6 +46,7 @@ style.
#include <stdio.h>
#include <string.h>
#include <unistd.h>
+#include <errno.h>
static int wu_fbid(const char *devname, char **fbname, int *fbtype);
@@ -160,6 +161,8 @@ wu_fbid(const char* devname, char** fbname, int* fbtype)
#endif
if ( (fd = open(devname, DEV_OPEN_MODE, 0)) == -1 ) {
+ fprintf(stderr, "unable to open %s: %s\n",
+ devname, strerror(errno));
*fbname = "unable to open fb";
return 2;
}
@@ -178,6 +181,8 @@ wu_fbid(const char* devname, char** fbname, int* fbtype)
ioctl_ret = ioctl(fd, FBIOGTYPE, &fbattr.fbtype);
close(fd);
if ( ioctl_ret == -1 ) {
+ fprintf(stderr, "FBIO ioctls failed on %s: %s\n",
+ devname, strerror(errno));
*fbname = "ioctl on fb failed";
return 2;
}