Releasing watchdog from the application

Hi All,

My application is able to take the control of the watchdog and is able to tickle it. But when it releases it, the control does seem to go back to procd but in the kernel logs I see something like this.

daemon.err procd: WDT failed to write: Bad file descriptor.

I had a look at the procd code in OpenWRT and it seems to me like it is trying to reuse the same fd of the watchdog which it had previously closed when the application took over the control of the watchdog. I tried setting the wdt_fd to -1 in function "watchdog_close" so that it re-opens and uses the new fd in place of the old invalid one. With this fix I couldn't see the above error log message and everything seemed to be okay.

I am not sure if there is really a problem or did I goof up something? The procd patch is from procd-2016-03-09 version.