chiark / gitweb /
Merge nss-myhostname
[elogind.git] / src / udev / accelerometer / accelerometer.c
index 08be363370e89b4876bbcb2bf22eab70f59fcb2d..21f51936eebbb6c13c071ff49ee1763331f69753 100644 (file)
  *   Timo Rongas <ext-timo.2.rongas@nokia.com>
  *   Lihan Guo <lihan.guo@digia.com>
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with keymap; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <stdio.h>
@@ -205,8 +205,10 @@ static void test_orientation(struct udev *udev,
 
                 r = read(fd, ev, sizeof(struct input_event) * 64);
 
-                if (r < (int) sizeof(struct input_event))
+                if (r < (int) sizeof(struct input_event)) {
+                        close(fd);
                         return;
+                }
 
                 for (i = 0; i < r / (int) sizeof(struct input_event); i++) {
                         if (got_syn == 1) {
@@ -277,8 +279,8 @@ int main (int argc, char** argv)
                 switch (option) {
                 case 'd':
                         debug = 1;
-                        if (udev_get_log_priority(udev) < LOG_INFO)
-                                udev_set_log_priority(udev, LOG_INFO);
+                        log_set_max_level(LOG_DEBUG);
+                        udev_set_log_priority(udev, LOG_DEBUG);
                         break;
                 case 'h':
                         help();