Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
ca33941f
...
ca33941fa5583a48b896d37ea7313fafec38bd03
authored
2002-02-07 16:02:05 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
(util_localname): return FQDN
1 parent
847504ce
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
2 deletions
imap4d/util.c
imap4d/util.c
View file @
ca33941
...
...
@@ -858,7 +858,8 @@ util_localname ()
char
*
name
;
int
name_len
=
256
;
int
status
;
struct
hostent
*
hp
;
name
=
malloc
(
name_len
);
while
(
name
&&
(
status
=
gethostname
(
name
,
name_len
))
==
0
...
...
@@ -872,7 +873,20 @@ util_localname ()
syslog
(
LOG_CRIT
,
"Can't find out my own hostname"
);
exit
(
1
);
}
hp
=
gethostbyname
(
name
);
if
(
hp
)
{
struct
in_addr
inaddr
;
inaddr
.
s_addr
=
*
(
unsigned
int
*
)
hp
->
h_addr
;
hp
=
gethostbyaddr
((
const
char
*
)
&
inaddr
,
sizeof
(
struct
in_addr
),
AF_INET
);
if
(
hp
)
{
free
(
name
);
name
=
strdup
((
char
*
)
hp
->
h_name
);
}
}
localname
=
name
;
}
return
localname
;
...
...
Please
register
or
sign in
to post a comment