Merge commit '28dbfe9bf7a799ab1da2563fd5e007d007b54168'
[osmocom-bb.git] / src / shared / libosmocore / src / select.c
index 2f6afa7..adf3619 100644 (file)
@@ -5,8 +5,9 @@
  * (C) 2000-2009 by Harald Welte <laforge@gnumonks.org>
  *
  *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 2 
- *  as published by the Free Software Foundation
+ *  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
  */
 
 #include <fcntl.h>
-#include <osmocore/select.h>
-#include <osmocore/linuxlist.h>
-#include <osmocore/timer.h>
+#include <stdio.h>
+
+#include <osmocom/core/select.h>
+#include <osmocom/core/linuxlist.h>
+#include <osmocom/core/timer.h>
 
 #include "../config.h"
 
@@ -48,6 +51,16 @@ int bsc_register_fd(struct bsc_fd *fd)
        if (fd->fd > maxfd)
                maxfd = fd->fd;
 
+#ifdef BSC_FD_CHECK
+       struct bsc_fd *entry;
+       llist_for_each_entry(entry, &bsc_fds, list) {
+               if (entry == fd) {
+                       fprintf(stderr, "Adding a bsc_fd that is already in the list.\n");
+                       return 0;
+               }
+       }
+#endif
+
        llist_add_tail(&fd->list, &bsc_fds);
 
        return 0;