Skip to content
Snippets Groups Projects
Commit 4e7177cb authored by Jean-Philippe Baud's avatar Jean-Philippe Baud Committed by Steven Murray
Browse files

fix a few typos, add fclose and remove printf

parent cadead6a
Branches
Tags
No related merge requests found
......@@ -4,7 +4,7 @@
*/
#ifndef lint
static char sccsid[] = "@(#)$RCSfile: Cdomainname.c,v $ $Revision: 1.1 $ $Date: 2002/03/14 11:18:42 $ CERN IT-DS/HSM Jean-Philippe Baud";
static char sccsid[] = "@(#)$RCSfile: Cdomainname.c,v $ $Revision: 1.2 $ $Date: 2002/03/14 11:38:45 $ CERN IT-DS/HSM Jean-Philippe Baud";
#endif /* not lint */
#include <errno.h>
......@@ -43,12 +43,13 @@ int DLL_DECL Cdomainname(char *name, int namelen)
while (fgets (line, sizeof(line), fd) != NULL) {
if ((strncmp (line, "domain", 6) == 0 ||
strncmp (line, "search", 6) == 0) && line[6] == ' ') {
fclose (fd);
p = line + 6;
while (*p == ' ')
p++;
if (*p)
*(p + strlen (p) - 1) = '\0';
if (sizeof (p) > namelen) {
if (strlen (p) > namelen) {
serrno = EINVAL;
return (-1);
}
......@@ -56,7 +57,7 @@ int DLL_DECL Cdomainname(char *name, int namelen)
return (0);
}
}
fclose(fd);
fclose (fd);
}
#endif
......@@ -95,7 +96,7 @@ int DLL_DECL Cdomainname(char *name, int namelen)
if (p = strchr (hp2->h_name, '.')) {
free (haddrarray);
p++;
if (sizeof (p) > namelen) {
if (strlen (p) > namelen) {
serrno = EINVAL;
return (-1);
}
......@@ -110,7 +111,7 @@ int DLL_DECL Cdomainname(char *name, int namelen)
if (p = strchr (*hal, '.')) {
free (haddrarray);
p++;
if (sizeof (p) > namelen) {
if (strlen (p) > namelen) {
serrno = EINVAL;
return (-1);
}
......@@ -119,7 +120,6 @@ int DLL_DECL Cdomainname(char *name, int namelen)
}
hal++;
}
printf("end of list\n");
}
}
free (haddrarray);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment