snap-confine: provide proper error message on sc_sanity_timeout
The code that communicates with the helper process does setup
a "sanity" timeout currently. If that timeout is reached then
snap-confine dies. Unfortunately the error message is misleading
and says "interrupted system call" which does not help finding
the underlying issue.
This PR changes the code so that the timeout is checked before
the read error is printed. This will lead to the slightly better:
```
error: sanity timeout expired
```
which is still not great but it helps to see that this is not
an error in the code but something with the interaction of
snap-confine and its helpers.
The instance key needs to be set before we attempt to discover the implicit
hooks carried by the snap. Otherwise, the autodiscovery code ends up looking at
an incorrect location.
Signed-off-by: Maciej Borzecki <email address hidden>
overlord/snapstate: format the refresh time for the log
This is a very trivial change, but it's annoying enough that I needed
to push it out there. Currently we just `%s` the refresh time to the
log on startup,
```
Next refresh scheduled for 2019-01-30 14:36:37.783240257 +0000 GMT m=+17709.346348484.
```
which is rather nasty. With this change,
```
Next refresh scheduled for 2019-01-30T15:11:02Z.
```