[DragonFlyBSD - Bug #2982] Failed compile due to fetch.h and MAXHOSTNAMELEN

bugtracker-admin at leaf.dragonflybsd.org bugtracker-admin at leaf.dragonflybsd.org
Sun Feb 19 10:49:31 PST 2017


Issue #2982 has been updated by noloader.


noloader wrote:
> ...
> Looking at gethostname(3) (http://man.openbsd.org/gethostname.3), I can't tell if fetch.h is supposed to include <unistd.h> or <sys/param.h>. I'm guessing <unistd.h> would be a good choice.

<unistd.h> did not help. <sys/param.h> was needed to clear the issue.



----------------------------------------
Bug #2982: Failed compile due to fetch.h and MAXHOSTNAMELEN
http://bugs.dragonflybsd.org/issues/2982#change-13073

* Author: noloader
* Status: New
* Priority: Normal
* Assignee: 
* Category: 
* Target version: Latest stable
----------------------------------------
I'm trying to build pkgin for DragonFly. The compile is failing due to fetch.h and MAXHOSTNAMELEN (http://github.com/NetBSDfr/pkgin/issues/74):

$ make
gcc  -O -pipe    -std=gnu99  -c main.c
In file included from pkgin.h:45:0,
                 from main.c:33:
/usr/include/fetch.h:44:14: error: 'MAXHOSTNAMELEN' undeclared here (not in a function)
  char   host[MAXHOSTNAMELEN+1];
              ^
/usr/include/fetch.h:59:14: error: 'PATH_MAX' undeclared here (not in a function)
  char   name[PATH_MAX];
              ^

Looking at /usr/include/fetch.h, it does not include a header which defines MAXHOSTNAMELEN; and it does not define MAXHOSTNAMELEN itself:

$ cat fetch.h
...

#ifndef _FETCH_H_INCLUDED
#define _FETCH_H_INCLUDED

#define _LIBFETCH_VER "libfetch/2.0"

#define URL_SCHEMELEN 16
#define URL_USERLEN 256
#define URL_PWDLEN 256

struct url {
        char             scheme[URL_SCHEMELEN+1];
        char             user[URL_USERLEN+1];
        char             pwd[URL_PWDLEN+1];
        char             host[MAXHOSTNAMELEN+1];
        int              port;
        char            *doc;
        off_t            offset;
        size_t           length;
        time_t           ims_time;
};
...

MAXHOSTNAMELEN is defined to 256 is a couple of other header files, but those headers are not picked up in fetch.h.

Looking at gethostname(3) (http://man.openbsd.org/gethostname.3), I can't tell if fetch.h is supposed to include <unistd.h> or <sys/param.h>. I'm guessing <unistd.h> would be a good choice.



-- 
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account



More information about the Bugs mailing list