[Goodies-dev] [Bug 10822] New: Use of ifconfig

bugzilla-daemon at xfce.org bugzilla-daemon at xfce.org
Wed Apr 16 00:16:12 CEST 2014


https://bugzilla.xfce.org/show_bug.cgi?id=10822

            Bug ID: 10822
           Summary: Use of ifconfig
    Classification: Panel Plugins
           Product: Xfce4-wavelan-plugin
           Version: unspecified
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: Medium
         Component: General
          Assignee: frivoal at xfce.org
          Reporter: edbatalha at yahoo.com
        QA Contact: goodies-dev at xfce.org

I'm running a linuxfromscratch distribution.

I compiled and installed the wavelan plugin (0.5.11) but it was crashing every
time I tried to add it to the panel.

I've realised the problem was the use of popen("/sbin/ifconfig -a", "r") in the
wavelan_query_interfaces function. By default, linuxfromscratch does not
install ifconfig. 

I propose that the function reads from /proc/net/dev instead, to find the list
of interfaces, like this.

static GList*
wavelan_query_interfaces (void)
{
  GList *interfaces = NULL;
  gchar  line[1024];
  FILE  *fp;
  gint   m,n;

  TRACE ("Entered wavelan_query_interface");

  fp = fopen ("/proc/net/dev", "r");
  if (fp != NULL)
    {
      fgets (line, 1024, fp); //Ignore the first 2 lines
      fgets (line, 1024, fp);

      while (fgets (line, 1024, fp) != NULL)
        {
          for (m = 0; !isalnum(line[m]); ++m);
          for (n = m; isalnum (line[n]); ++n);
          line[n] = '\0';

          interfaces = g_list_append (interfaces, g_strdup (&line[m]));
        }

      pclose (fp);
    }

  return interfaces;
}

-- 
You are receiving this mail because:
You are the QA Contact for the bug.


More information about the Goodies-dev mailing list