Bug 4052 - Interface detection code fails if build host has no interfaces
Summary: Interface detection code fails if build host has no interfaces
Status: NEW
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: Build environment (show other bugs)
Version: 3.0.23b
Hardware: All Linux
: P3 normal
Target Milestone: none
Assignee: Tim Potter
QA Contact: Samba QA Contact
URL: http://bugs.debian.org/cgi-bin/bugrep...
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-25 14:12 UTC by Peter Eisentraut
Modified: 2006-08-25 14:12 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Eisentraut 2006-08-25 14:12:13 UTC
The code to detect the method to detect interfaces fails if the build host does not have any interfaces.  This seems to be the normal situation on a Linux vserver (not even a loopback device).  A patch has been submitted to the Debian bug tracking system that seems to solve this problem, but you may want to give it broader portability testing.

---
--- source/lib/interfaces.c     2005-07-28 15:19:45.000000000 +0200
+++ interfaces.c.naive-fix      2006-08-20 23:58:41.000000000 +0200
@@ -397,7 +397,7 @@
        int i;

        printf("got %d interfaces:\n", total);
-       if (total <= 0) exit(1);
+       if (total < 0) exit(1);

        for (i=0;i<total;i++) {
                printf("%-10s ", ifaces[i].name);
---

This should work because a failure in the interface detection method comes back as -1, while 0 should be a valid result.