Re: [PATCH] agetty: Reprompt once the network addresses change if address displayed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03 Jul 2015 14:58, Stef Walter wrote:
  #ifdef AGETTY_RELOAD
>  # include <sys/inotify.h>
> +# include <linux/netlink.h>
> +# include <linux/rtnetlink.h>

why not use libmnl instead ?
	http://netfilter.org/projects/libmnl

> +static void open_netlink(void)
> +{
> ...
> +		if (bind(sock,(struct sockaddr *)&addr, sizeof(addr)) < 0)

need space after the first ,

> +			close (sock);

no space before the (

> +static int process_netlink_msg(int *changed)
> +{
> +	char buf[4096];
> +	struct sockaddr_nl snl;
> +	struct iovec iov = { buf, sizeof buf };
> +	struct msghdr msg = { (void*)&snl, sizeof (snl), &iov, 1, NULL, 0, 0 };

would be nice to use nmed initializers imo.  makes it easier to read, more 
portable, and less error prone.

	struct iovec iov = {
		.iov_base = ...,
		.iov_len = ...,
	};

also your use of parens w/sizeof is inconsistent.  should use them, and not put 
a space between them.

> +		close (netlink_fd);

no space before the (

> +			close (netlink_fd);

same here

> +	for (;;) {

while (1) is more common i think

> +		} else if (inotify_fd >= 0 && FD_ISSET (inotify_fd, &rfds)) {

no space before the (
-mike

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux