aboutsummaryrefslogtreecommitdiffstats
path: root/common.c
diff options
context:
space:
mode:
authorDmitry Shmidt <dimitrysh@google.com>2010-01-08 10:47:26 -0800
committerDmitry Shmidt <dimitrysh@google.com>2010-01-08 10:47:26 -0800
commit938bc384f44031877543765a9ae18c764f5da9c8 (patch)
tree3c5d3e2749b7b1bef613a1283373d61945db7421 /common.c
parentb22386a3de85d94030c7071760f4a5e3368bfbe5 (diff)
downloadexternal_dhcpcd-938bc384f44031877543765a9ae18c764f5da9c8.zip
external_dhcpcd-938bc384f44031877543765a9ae18c764f5da9c8.tar.gz
external_dhcpcd-938bc384f44031877543765a9ae18c764f5da9c8.tar.bz2
dhcpcd: Upgrade from 4.0.1 to 4.0.15
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Diffstat (limited to 'common.c')
-rw-r--r--common.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/common.c b/common.c
index d90c7d2..da22a5c 100644
--- a/common.c
+++ b/common.c
@@ -69,7 +69,8 @@ get_line(char **line, size_t *len, FILE *fp)
}
p = *line + last;
memset(p, 0, BUFSIZ);
- fgets(p, BUFSIZ, fp);
+ if (fgets(p, BUFSIZ, fp) == NULL)
+ break;
last += strlen(p);
if (last && (*line)[last - 1] == '\n') {
(*line)[last - 1] = '\0';
@@ -201,9 +202,8 @@ get_monotonic(struct timeval *tp)
if (posix_clock_set == 0) {
if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
posix_clock = CLOCK_MONOTONIC;
- clock_monotonic = 1;
+ clock_monotonic = posix_clock_set = 1;
}
- posix_clock_set = 1;
}
if (clock_monotonic) {
@@ -225,9 +225,8 @@ get_monotonic(struct timeval *tp)
if (posix_clock_set == 0) {
if (mach_timebase_info(&info) == KERN_SUCCESS) {
factor = (double)info.numer / (double)info.denom;
- clock_monotonic = 1;
+ clock_monotonic = posix_clock_set = 1;
}
- posix_clock_set = 1;
}
if (clock_monotonic) {
nano = mach_absolute_time();