- if((in = fopen(filename, "r")) == 0)
- {
- sendto_one(source_p, ":%s NOTICE %s :Cannot open %s", me.name, parv[0], filename);
- return 0;
- }
-
- oldumask = umask(0);
- if((out = fopen(temppath, "w")) == 0)
- {
- sendto_one(source_p, ":%s NOTICE %s :Cannot open %s", me.name, parv[0], temppath);
- fclose(in);
- umask(oldumask);
- return 0;
- }
-
- umask(oldumask);
-
- while (fgets(buf, sizeof(buf), in))
- {
- strlcpy(buff, buf, sizeof(buff));
-
- if((p = strchr(buff, '\n')) != NULL)
- *p = '\0';
-
- if((*buff == '\0') || (*buff == '#'))
- {
- if(!error_on_write)
- flush_write(source_p, out, buf, temppath);
- continue;
- }
-
- if((found_cidr = getfield(buff)) == NULL)
- {
- if(!error_on_write)
- flush_write(source_p, out, buf, temppath);
- continue;
- }
-
- if(irccmp(found_cidr, aconf->host) == 0)
- {
- pairme++;
- }
- else
- {
- if(!error_on_write)
- flush_write(source_p, out, buf, temppath);
- continue;
- }
- }
-
- fclose(in);
- if (fclose(out))
- error_on_write = YES;
-
- if(error_on_write)
- {
- sendto_one(source_p,
- ":%s NOTICE %s :Couldn't write D-line file, aborted",
- me.name, parv[0]);
- return 0;
- }
- else if(!pairme)
- {
- sendto_one_notice(source_p, ":Cannot find D-Line for %s in file",
- aconf->host);
-
- if(temppath != NULL)
- (void) unlink(temppath);
-
- return 0;
- }
-
- if (rename(temppath, filename))
- {
- sendto_one_notice(source_p, ":Couldn't rename temp file, aborted");
- return 0;
- }
-
- sendto_one(source_p, ":%s NOTICE %s :D-Line for [%s] is removed", me.name, parv[0], aconf->host);
- sendto_realops_snomask(SNO_GENERAL, L_ALL,
- "%s has removed the D-Line for: [%s]", get_oper_name(source_p), aconf->host);
+ sendto_one(source_p, ":%s NOTICE %s :D-Line for [%s] is removed", me.name, source_p->name,
+ aconf->host);
+ sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s has removed the D-Line for: [%s]",
+ get_oper_name(source_p), aconf->host);