-/* sonar, Copyright (c) 1998-2008 Jamie Zawinski and Stephen Martin
+/* sonar, Copyright (c) 1998-2009 Jamie Zawinski and Stephen Martin
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
strlen (sb->name) >= 80)
return 0;
+ /* .ssh/known_hosts sometimes contains weirdness like "[host]:port".
+ Ignore it. */
+ if (strchr (sb->name, '['))
+ {
+ if (pd->debug_p)
+ fprintf (stderr, "%s: ignoring bogus address \"%s\"\n",
+ progname, sb->name);
+ return 0;
+ }
+
+ /* If the name contains a colon, it's probably IPv6. */
+ if (strchr (sb->name, ':'))
+ {
+ if (pd->debug_p)
+ fprintf (stderr, "%s: ignoring ipv6 address \"%s\"\n",
+ progname, sb->name);
+ return 0;
+ }
+
hent = gethostbyname (sb->name);
if (!hent)
{
if (pd->debug_p)
- fprintf (stderr, "%s: could not resolve host: %s\n",
+ fprintf (stderr, "%s: could not resolve host: %s\n",
progname, sb->name);
return 0;
}
if (!fp)
{
char buf[1024];
- sprintf(buf, "%s: %s", progname, filename);
+ sprintf(buf, "%s: %s", progname, filename);
#ifdef HAVE_COCOA
if (pd->debug_p) /* on OSX don't syslog this */
#endif
/* Get the name and address */
- name = addr = 0;
if ((addr = strtok(buf, " ,;\t\n")))
name = strtok(0, " ,;\t\n");
else
ping_bogie *pb = (ping_bogie *) b->closure;
u_char *packet;
struct ICMP *icmph;
- int result;
const char *token = "org.jwz.xscreensaver.sonar";
int pcktsiz = (sizeof(struct ICMP) + sizeof(struct timeval) +
/* Send it */
- if ((result = sendto(pd->icmpsock, packet, pcktsiz, 0,
- &pb->address, sizeof(pb->address)))
+ if (sendto(pd->icmpsock, packet, pcktsiz, 0,
+ &pb->address, sizeof(pb->address))
!= pcktsiz)
{
#if 0
if (new)
{
sonar_bogie *nn = new;
- while (nn && nn->next)
+ while (nn->next)
nn = nn->next;
nn->next = hostlist;
hostlist = new;