udhcpd: add code which rejects lease files with suspicious or old timestamp.
*: s/time(0)/time(NULL)/g
diff --git a/e2fsprogs/old_e2fsprogs/blkid/devname.c b/e2fsprogs/old_e2fsprogs/blkid/devname.c
index 5b9e48f..348e5d4 100644
--- a/e2fsprogs/old_e2fsprogs/blkid/devname.c
+++ b/e2fsprogs/old_e2fsprogs/blkid/devname.c
@@ -273,7 +273,7 @@
return -BLKID_ERR_PARAM;
if (cache->bic_flags & BLKID_BIC_FL_PROBED &&
- time(0) - cache->bic_time < BLKID_PROBE_INTERVAL)
+ time(NULL) - cache->bic_time < BLKID_PROBE_INTERVAL)
return 0;
blkid_read_cache(cache);
@@ -335,7 +335,7 @@
fclose(proc);
- cache->bic_time = time(0);
+ cache->bic_time = time(NULL);
cache->bic_flags |= BLKID_BIC_FL_PROBED;
blkid_flush_cache(cache);
return 0;
diff --git a/e2fsprogs/old_e2fsprogs/blkid/probe.c b/e2fsprogs/old_e2fsprogs/blkid/probe.c
index 48b240e..1f7188e 100644
--- a/e2fsprogs/old_e2fsprogs/blkid/probe.c
+++ b/e2fsprogs/old_e2fsprogs/blkid/probe.c
@@ -562,7 +562,7 @@
if (!dev)
return NULL;
- now = time(0);
+ now = time(NULL);
diff = now - dev->bid_time;
if ((now < dev->bid_time) ||
@@ -659,7 +659,7 @@
found_type:
if (dev && type) {
dev->bid_devno = st.st_rdev;
- dev->bid_time = time(0);
+ dev->bid_time = time(NULL);
dev->bid_flags |= BLKID_BID_FL_VERIFIED;
cache->bic_flags |= BLKID_BIC_FL_CHANGED;
diff --git a/e2fsprogs/old_e2fsprogs/e2fsck.c b/e2fsprogs/old_e2fsprogs/e2fsck.c
index b927a9f..6ade0db 100644
--- a/e2fsprogs/old_e2fsprogs/e2fsck.c
+++ b/e2fsprogs/old_e2fsprogs/e2fsck.c
@@ -2270,7 +2270,7 @@
ext2fs_mark_super_dirty(fs);
fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY;
inode.i_links_count = 0;
- inode.i_dtime = time(0);
+ inode.i_dtime = time(NULL);
if ((retval = ext2fs_write_inode(fs, ino, &inode)) != 0)
goto err_out;
@@ -3381,7 +3381,7 @@
*/
if (!LINUX_S_ISDIR(inode->i_mode)) {
if (fix_problem(ctx, PR_1_ROOT_NO_DIR, &pctx)) {
- inode->i_dtime = time(0);
+ inode->i_dtime = time(NULL);
inode->i_links_count = 0;
ext2fs_icount_store(ctx->inode_link_info,
ino, 0);
@@ -3475,7 +3475,7 @@
inode->i_dtime < ctx->fs->super->s_inodes_count) {
if (fix_problem(ctx, PR_1_LOW_DTIME, &pctx)) {
inode->i_dtime = inode->i_links_count ?
- 0 : time(0);
+ 0 : time(NULL);
e2fsck_write_inode(ctx, ino, inode,
"pass1");
}
@@ -3489,7 +3489,7 @@
if (!inode->i_dtime && inode->i_mode) {
if (fix_problem(ctx,
PR_1_ZERO_DTIME, &pctx)) {
- inode->i_dtime = time(0);
+ inode->i_dtime = time(NULL);
e2fsck_write_inode(ctx, ino, inode,
"pass1");
}
@@ -3659,7 +3659,7 @@
}
e2fsck_read_inode(ctx, EXT2_RESIZE_INO, inode,
"recreate inode");
- inode->i_mtime = time(0);
+ inode->i_mtime = time(NULL);
e2fsck_write_inode(ctx, EXT2_RESIZE_INO, inode,
"recreate inode");
fs->block_map = save_bmap;
@@ -4169,7 +4169,7 @@
if (pb.clear) {
inode->i_links_count = 0;
ext2fs_icount_store(ctx->inode_link_info, ino, 0);
- inode->i_dtime = time(0);
+ inode->i_dtime = time(NULL);
dirty_inode++;
ext2fs_unmark_inode_bitmap(ctx->inode_dir_map, ino);
ext2fs_unmark_inode_bitmap(ctx->inode_reg_map, ino);
@@ -4202,7 +4202,7 @@
if (fix_problem(ctx, PR_1_ZERO_LENGTH_DIR, pctx)) {
inode->i_links_count = 0;
ext2fs_icount_store(ctx->inode_link_info, ino, 0);
- inode->i_dtime = time(0);
+ inode->i_dtime = time(NULL);
dirty_inode++;
ext2fs_unmark_inode_bitmap(ctx->inode_dir_map, ino);
ext2fs_unmark_inode_bitmap(ctx->inode_reg_map, ino);
@@ -5147,7 +5147,7 @@
/* Inode may have changed by block_iterate, so reread it */
e2fsck_read_inode(ctx, ino, &inode, "delete_file");
inode.i_links_count = 0;
- inode.i_dtime = time(0);
+ inode.i_dtime = time(NULL);
if (inode.i_file_acl &&
(fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_EXT_ATTR)) {
count = 1;
@@ -6393,7 +6393,7 @@
ext2fs_icount_store(ctx->inode_link_info, ino, 0);
e2fsck_read_inode(ctx, ino, &inode, "deallocate_inode");
inode.i_links_count = 0;
- inode.i_dtime = time(0);
+ inode.i_dtime = time(NULL);
e2fsck_write_inode(ctx, ino, &inode, "deallocate_inode");
clear_problem_context(&pctx);
pctx.ino = ino;
@@ -6890,7 +6890,7 @@
memset(&inode, 0, sizeof(inode));
inode.i_mode = 040755;
inode.i_size = fs->blocksize;
- inode.i_atime = inode.i_ctime = inode.i_mtime = time(0);
+ inode.i_atime = inode.i_ctime = inode.i_mtime = time(NULL);
inode.i_links_count = 2;
inode.i_blocks = fs->blocksize / 512;
inode.i_block[0] = blk;
@@ -7138,7 +7138,7 @@
memset(&inode, 0, sizeof(inode));
inode.i_mode = 040700;
inode.i_size = fs->blocksize;
- inode.i_atime = inode.i_ctime = inode.i_mtime = time(0);
+ inode.i_atime = inode.i_ctime = inode.i_mtime = time(NULL);
inode.i_links_count = 2;
inode.i_blocks = fs->blocksize / 512;
inode.i_block[0] = blk;
@@ -7492,7 +7492,7 @@
if (fix_problem(ctx, PR_4_ZERO_LEN_INODE, &pctx)) {
ext2fs_icount_store(ctx->inode_link_info, i, 0);
inode.i_links_count = 0;
- inode.i_dtime = time(0);
+ inode.i_dtime = time(NULL);
e2fsck_write_inode(ctx, i, &inode,
"disconnect_inode");
/*
@@ -11558,7 +11558,7 @@
if (!inode.i_links_count) {
ext2fs_inode_alloc_stats2(fs, ino, -1,
LINUX_S_ISDIR(inode.i_mode));
- inode.i_dtime = time(0);
+ inode.i_dtime = time(NULL);
} else {
inode.i_dtime = 0;
}
@@ -12714,7 +12714,7 @@
unsigned int reason_arg = 0;
long next_check;
int batt = is_on_batt();
- time_t now = time(0);
+ time_t now = time(NULL);
if ((ctx->options & E2F_OPT_FORCE) || cflag || swapfs)
return;
diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/bb_inode.c b/e2fsprogs/old_e2fsprogs/ext2fs/bb_inode.c
index 855f86e..1deae54 100644
--- a/e2fsprogs/old_e2fsprogs/ext2fs/bb_inode.c
+++ b/e2fsprogs/old_e2fsprogs/ext2fs/bb_inode.c
@@ -125,9 +125,9 @@
if (retval)
goto cleanup;
- inode.i_atime = inode.i_mtime = time(0);
+ inode.i_atime = inode.i_mtime = time(NULL);
if (!inode.i_ctime)
- inode.i_ctime = time(0);
+ inode.i_ctime = time(NULL);
inode.i_blocks = rec.bad_block_count * (fs->blocksize / 512);
inode.i_size = rec.bad_block_count * fs->blocksize;
diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/mkjournal.c b/e2fsprogs/old_e2fsprogs/ext2fs/mkjournal.c
index 5bdd346..af47aee 100644
--- a/e2fsprogs/old_e2fsprogs/ext2fs/mkjournal.c
+++ b/e2fsprogs/old_e2fsprogs/ext2fs/mkjournal.c
@@ -231,7 +231,7 @@
inode.i_size += fs->blocksize * size;
inode.i_blocks += (fs->blocksize / 512) * es.newblocks;
- inode.i_mtime = inode.i_ctime = time(0);
+ inode.i_mtime = inode.i_ctime = time(NULL);
inode.i_links_count = 1;
inode.i_mode = LINUX_S_IFREG | 0600;
diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/res_gdt.c b/e2fsprogs/old_e2fsprogs/ext2fs/res_gdt.c
index 31cc89e..3c550d5 100644
--- a/e2fsprogs/old_e2fsprogs/ext2fs/res_gdt.c
+++ b/e2fsprogs/old_e2fsprogs/ext2fs/res_gdt.c
@@ -117,7 +117,7 @@
sb->s_feature_ro_compat |=
EXT2_FEATURE_RO_COMPAT_LARGE_FILE;
}
- inode.i_ctime = time(0);
+ inode.i_ctime = time(NULL);
}
for (rsv_off = 0, gdt_off = fs->desc_blocks,
@@ -209,7 +209,7 @@
inode.i_size);
#endif
if (inode_dirty) {
- inode.i_atime = inode.i_mtime = time(0);
+ inode.i_atime = inode.i_mtime = time(NULL);
retval2 = ext2fs_write_inode(fs, EXT2_RESIZE_INO, &inode);
if (!retval)
retval = retval2;