aboutsummaryrefslogtreecommitdiffhomepage
path: root/common.c
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2009-02-03 08:46:45 +1000
committerGravatar axel <axel@liljencrantz.se>2009-02-03 08:46:45 +1000
commit72025a6a38e3aed4dadab5013dc64e0a432ba992 (patch)
treebb76f15f13c68e3ed4008da8f9e19d539c0524d0 /common.c
parent05341b055bb27c9a9036a1ebc99503fd4825e35f (diff)
Make fish avoid iterating through user list when completing file part of directory starting with tilde. Also add a timeout to the directory iteration, to protect against humongously large user databases.
darcs-hash:20090202224645-ac50b-353047a73e4d6f494f470fe2ea6c4a34b486d302.gz
Diffstat (limited to 'common.c')
-rw-r--r--common.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/common.c b/common.c
index ed7b92a7..4a21dbb7 100644
--- a/common.c
+++ b/common.c
@@ -1805,3 +1805,18 @@ void sb_format_size( string_buffer_t *sb,
}
}
}
+
+double timef()
+{
+ int time_res;
+ struct timeval tv;
+
+ time_res = gettimeofday(&tv, 0);
+
+ if( time_res )
+ {
+ return NAN;
+ }
+
+ return (double)tv.tv_sec + 0.000001*tv.tv_usec;
+}