udhcpd: add code which rejects lease files with suspicious or old timestamp.
*: s/time(0)/time(NULL)/g
This commit is contained in:
parent
512c8ae053
commit
04158e0459
@ -273,7 +273,7 @@ int blkid_probe_all(blkid_cache cache)
|
|||||||
return -BLKID_ERR_PARAM;
|
return -BLKID_ERR_PARAM;
|
||||||
|
|
||||||
if (cache->bic_flags & BLKID_BIC_FL_PROBED &&
|
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;
|
return 0;
|
||||||
|
|
||||||
blkid_read_cache(cache);
|
blkid_read_cache(cache);
|
||||||
@ -335,7 +335,7 @@ int blkid_probe_all(blkid_cache cache)
|
|||||||
|
|
||||||
fclose(proc);
|
fclose(proc);
|
||||||
|
|
||||||
cache->bic_time = time(0);
|
cache->bic_time = time(NULL);
|
||||||
cache->bic_flags |= BLKID_BIC_FL_PROBED;
|
cache->bic_flags |= BLKID_BIC_FL_PROBED;
|
||||||
blkid_flush_cache(cache);
|
blkid_flush_cache(cache);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -562,7 +562,7 @@ blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev)
|
|||||||
if (!dev)
|
if (!dev)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
now = time(0);
|
now = time(NULL);
|
||||||
diff = now - dev->bid_time;
|
diff = now - dev->bid_time;
|
||||||
|
|
||||||
if ((now < dev->bid_time) ||
|
if ((now < dev->bid_time) ||
|
||||||
@ -659,7 +659,7 @@ try_again:
|
|||||||
found_type:
|
found_type:
|
||||||
if (dev && type) {
|
if (dev && type) {
|
||||||
dev->bid_devno = st.st_rdev;
|
dev->bid_devno = st.st_rdev;
|
||||||
dev->bid_time = time(0);
|
dev->bid_time = time(NULL);
|
||||||
dev->bid_flags |= BLKID_BID_FL_VERIFIED;
|
dev->bid_flags |= BLKID_BID_FL_VERIFIED;
|
||||||
cache->bic_flags |= BLKID_BIC_FL_CHANGED;
|
cache->bic_flags |= BLKID_BIC_FL_CHANGED;
|
||||||
|
|
||||||
|
@ -2270,7 +2270,7 @@ static void e2fsck_move_ext3_journal(e2fsck_t ctx)
|
|||||||
ext2fs_mark_super_dirty(fs);
|
ext2fs_mark_super_dirty(fs);
|
||||||
fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY;
|
fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY;
|
||||||
inode.i_links_count = 0;
|
inode.i_links_count = 0;
|
||||||
inode.i_dtime = time(0);
|
inode.i_dtime = time(NULL);
|
||||||
if ((retval = ext2fs_write_inode(fs, ino, &inode)) != 0)
|
if ((retval = ext2fs_write_inode(fs, ino, &inode)) != 0)
|
||||||
goto err_out;
|
goto err_out;
|
||||||
|
|
||||||
@ -3381,7 +3381,7 @@ static void e2fsck_pass1(e2fsck_t ctx)
|
|||||||
*/
|
*/
|
||||||
if (!LINUX_S_ISDIR(inode->i_mode)) {
|
if (!LINUX_S_ISDIR(inode->i_mode)) {
|
||||||
if (fix_problem(ctx, PR_1_ROOT_NO_DIR, &pctx)) {
|
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;
|
inode->i_links_count = 0;
|
||||||
ext2fs_icount_store(ctx->inode_link_info,
|
ext2fs_icount_store(ctx->inode_link_info,
|
||||||
ino, 0);
|
ino, 0);
|
||||||
@ -3475,7 +3475,7 @@ static void e2fsck_pass1(e2fsck_t ctx)
|
|||||||
inode->i_dtime < ctx->fs->super->s_inodes_count) {
|
inode->i_dtime < ctx->fs->super->s_inodes_count) {
|
||||||
if (fix_problem(ctx, PR_1_LOW_DTIME, &pctx)) {
|
if (fix_problem(ctx, PR_1_LOW_DTIME, &pctx)) {
|
||||||
inode->i_dtime = inode->i_links_count ?
|
inode->i_dtime = inode->i_links_count ?
|
||||||
0 : time(0);
|
0 : time(NULL);
|
||||||
e2fsck_write_inode(ctx, ino, inode,
|
e2fsck_write_inode(ctx, ino, inode,
|
||||||
"pass1");
|
"pass1");
|
||||||
}
|
}
|
||||||
@ -3489,7 +3489,7 @@ static void e2fsck_pass1(e2fsck_t ctx)
|
|||||||
if (!inode->i_dtime && inode->i_mode) {
|
if (!inode->i_dtime && inode->i_mode) {
|
||||||
if (fix_problem(ctx,
|
if (fix_problem(ctx,
|
||||||
PR_1_ZERO_DTIME, &pctx)) {
|
PR_1_ZERO_DTIME, &pctx)) {
|
||||||
inode->i_dtime = time(0);
|
inode->i_dtime = time(NULL);
|
||||||
e2fsck_write_inode(ctx, ino, inode,
|
e2fsck_write_inode(ctx, ino, inode,
|
||||||
"pass1");
|
"pass1");
|
||||||
}
|
}
|
||||||
@ -3659,7 +3659,7 @@ static void e2fsck_pass1(e2fsck_t ctx)
|
|||||||
}
|
}
|
||||||
e2fsck_read_inode(ctx, EXT2_RESIZE_INO, inode,
|
e2fsck_read_inode(ctx, EXT2_RESIZE_INO, inode,
|
||||||
"recreate inode");
|
"recreate inode");
|
||||||
inode->i_mtime = time(0);
|
inode->i_mtime = time(NULL);
|
||||||
e2fsck_write_inode(ctx, EXT2_RESIZE_INO, inode,
|
e2fsck_write_inode(ctx, EXT2_RESIZE_INO, inode,
|
||||||
"recreate inode");
|
"recreate inode");
|
||||||
fs->block_map = save_bmap;
|
fs->block_map = save_bmap;
|
||||||
@ -4169,7 +4169,7 @@ static void check_blocks(e2fsck_t ctx, struct problem_context *pctx,
|
|||||||
if (pb.clear) {
|
if (pb.clear) {
|
||||||
inode->i_links_count = 0;
|
inode->i_links_count = 0;
|
||||||
ext2fs_icount_store(ctx->inode_link_info, ino, 0);
|
ext2fs_icount_store(ctx->inode_link_info, ino, 0);
|
||||||
inode->i_dtime = time(0);
|
inode->i_dtime = time(NULL);
|
||||||
dirty_inode++;
|
dirty_inode++;
|
||||||
ext2fs_unmark_inode_bitmap(ctx->inode_dir_map, ino);
|
ext2fs_unmark_inode_bitmap(ctx->inode_dir_map, ino);
|
||||||
ext2fs_unmark_inode_bitmap(ctx->inode_reg_map, ino);
|
ext2fs_unmark_inode_bitmap(ctx->inode_reg_map, ino);
|
||||||
@ -4202,7 +4202,7 @@ static void check_blocks(e2fsck_t ctx, struct problem_context *pctx,
|
|||||||
if (fix_problem(ctx, PR_1_ZERO_LENGTH_DIR, pctx)) {
|
if (fix_problem(ctx, PR_1_ZERO_LENGTH_DIR, pctx)) {
|
||||||
inode->i_links_count = 0;
|
inode->i_links_count = 0;
|
||||||
ext2fs_icount_store(ctx->inode_link_info, ino, 0);
|
ext2fs_icount_store(ctx->inode_link_info, ino, 0);
|
||||||
inode->i_dtime = time(0);
|
inode->i_dtime = time(NULL);
|
||||||
dirty_inode++;
|
dirty_inode++;
|
||||||
ext2fs_unmark_inode_bitmap(ctx->inode_dir_map, ino);
|
ext2fs_unmark_inode_bitmap(ctx->inode_dir_map, ino);
|
||||||
ext2fs_unmark_inode_bitmap(ctx->inode_reg_map, ino);
|
ext2fs_unmark_inode_bitmap(ctx->inode_reg_map, ino);
|
||||||
@ -5147,7 +5147,7 @@ static void delete_file(e2fsck_t ctx, ext2_ino_t ino,
|
|||||||
/* Inode may have changed by block_iterate, so reread it */
|
/* Inode may have changed by block_iterate, so reread it */
|
||||||
e2fsck_read_inode(ctx, ino, &inode, "delete_file");
|
e2fsck_read_inode(ctx, ino, &inode, "delete_file");
|
||||||
inode.i_links_count = 0;
|
inode.i_links_count = 0;
|
||||||
inode.i_dtime = time(0);
|
inode.i_dtime = time(NULL);
|
||||||
if (inode.i_file_acl &&
|
if (inode.i_file_acl &&
|
||||||
(fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_EXT_ATTR)) {
|
(fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_EXT_ATTR)) {
|
||||||
count = 1;
|
count = 1;
|
||||||
@ -6393,7 +6393,7 @@ static void deallocate_inode(e2fsck_t ctx, ext2_ino_t ino, char* block_buf)
|
|||||||
ext2fs_icount_store(ctx->inode_link_info, ino, 0);
|
ext2fs_icount_store(ctx->inode_link_info, ino, 0);
|
||||||
e2fsck_read_inode(ctx, ino, &inode, "deallocate_inode");
|
e2fsck_read_inode(ctx, ino, &inode, "deallocate_inode");
|
||||||
inode.i_links_count = 0;
|
inode.i_links_count = 0;
|
||||||
inode.i_dtime = time(0);
|
inode.i_dtime = time(NULL);
|
||||||
e2fsck_write_inode(ctx, ino, &inode, "deallocate_inode");
|
e2fsck_write_inode(ctx, ino, &inode, "deallocate_inode");
|
||||||
clear_problem_context(&pctx);
|
clear_problem_context(&pctx);
|
||||||
pctx.ino = ino;
|
pctx.ino = ino;
|
||||||
@ -6890,7 +6890,7 @@ static void check_root(e2fsck_t ctx)
|
|||||||
memset(&inode, 0, sizeof(inode));
|
memset(&inode, 0, sizeof(inode));
|
||||||
inode.i_mode = 040755;
|
inode.i_mode = 040755;
|
||||||
inode.i_size = fs->blocksize;
|
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_links_count = 2;
|
||||||
inode.i_blocks = fs->blocksize / 512;
|
inode.i_blocks = fs->blocksize / 512;
|
||||||
inode.i_block[0] = blk;
|
inode.i_block[0] = blk;
|
||||||
@ -7138,7 +7138,7 @@ ext2_ino_t e2fsck_get_lost_and_found(e2fsck_t ctx, int fix)
|
|||||||
memset(&inode, 0, sizeof(inode));
|
memset(&inode, 0, sizeof(inode));
|
||||||
inode.i_mode = 040700;
|
inode.i_mode = 040700;
|
||||||
inode.i_size = fs->blocksize;
|
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_links_count = 2;
|
||||||
inode.i_blocks = fs->blocksize / 512;
|
inode.i_blocks = fs->blocksize / 512;
|
||||||
inode.i_block[0] = blk;
|
inode.i_block[0] = blk;
|
||||||
@ -7492,7 +7492,7 @@ static int disconnect_inode(e2fsck_t ctx, ext2_ino_t i)
|
|||||||
if (fix_problem(ctx, PR_4_ZERO_LEN_INODE, &pctx)) {
|
if (fix_problem(ctx, PR_4_ZERO_LEN_INODE, &pctx)) {
|
||||||
ext2fs_icount_store(ctx->inode_link_info, i, 0);
|
ext2fs_icount_store(ctx->inode_link_info, i, 0);
|
||||||
inode.i_links_count = 0;
|
inode.i_links_count = 0;
|
||||||
inode.i_dtime = time(0);
|
inode.i_dtime = time(NULL);
|
||||||
e2fsck_write_inode(ctx, i, &inode,
|
e2fsck_write_inode(ctx, i, &inode,
|
||||||
"disconnect_inode");
|
"disconnect_inode");
|
||||||
/*
|
/*
|
||||||
@ -11558,7 +11558,7 @@ static int release_orphan_inodes(e2fsck_t ctx)
|
|||||||
if (!inode.i_links_count) {
|
if (!inode.i_links_count) {
|
||||||
ext2fs_inode_alloc_stats2(fs, ino, -1,
|
ext2fs_inode_alloc_stats2(fs, ino, -1,
|
||||||
LINUX_S_ISDIR(inode.i_mode));
|
LINUX_S_ISDIR(inode.i_mode));
|
||||||
inode.i_dtime = time(0);
|
inode.i_dtime = time(NULL);
|
||||||
} else {
|
} else {
|
||||||
inode.i_dtime = 0;
|
inode.i_dtime = 0;
|
||||||
}
|
}
|
||||||
@ -12714,7 +12714,7 @@ static void check_if_skip(e2fsck_t ctx)
|
|||||||
unsigned int reason_arg = 0;
|
unsigned int reason_arg = 0;
|
||||||
long next_check;
|
long next_check;
|
||||||
int batt = is_on_batt();
|
int batt = is_on_batt();
|
||||||
time_t now = time(0);
|
time_t now = time(NULL);
|
||||||
|
|
||||||
if ((ctx->options & E2F_OPT_FORCE) || cflag || swapfs)
|
if ((ctx->options & E2F_OPT_FORCE) || cflag || swapfs)
|
||||||
return;
|
return;
|
||||||
|
@ -125,9 +125,9 @@ errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list)
|
|||||||
if (retval)
|
if (retval)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
inode.i_atime = inode.i_mtime = time(0);
|
inode.i_atime = inode.i_mtime = time(NULL);
|
||||||
if (!inode.i_ctime)
|
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_blocks = rec.bad_block_count * (fs->blocksize / 512);
|
||||||
inode.i_size = rec.bad_block_count * fs->blocksize;
|
inode.i_size = rec.bad_block_count * fs->blocksize;
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ static errcode_t write_journal_inode(ext2_filsys fs, ext2_ino_t journal_ino,
|
|||||||
|
|
||||||
inode.i_size += fs->blocksize * size;
|
inode.i_size += fs->blocksize * size;
|
||||||
inode.i_blocks += (fs->blocksize / 512) * es.newblocks;
|
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_links_count = 1;
|
||||||
inode.i_mode = LINUX_S_IFREG | 0600;
|
inode.i_mode = LINUX_S_IFREG | 0600;
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ errcode_t ext2fs_create_resize_inode(ext2_filsys fs)
|
|||||||
sb->s_feature_ro_compat |=
|
sb->s_feature_ro_compat |=
|
||||||
EXT2_FEATURE_RO_COMPAT_LARGE_FILE;
|
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,
|
for (rsv_off = 0, gdt_off = fs->desc_blocks,
|
||||||
@ -209,7 +209,7 @@ out_inode:
|
|||||||
inode.i_size);
|
inode.i_size);
|
||||||
#endif
|
#endif
|
||||||
if (inode_dirty) {
|
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);
|
retval2 = ext2fs_write_inode(fs, EXT2_RESIZE_INO, &inode);
|
||||||
if (!retval)
|
if (!retval)
|
||||||
retval = retval2;
|
retval = retval2;
|
||||||
|
@ -969,7 +969,7 @@ static void send_headers(int responseNum)
|
|||||||
const char *error_page = NULL;
|
const char *error_page = NULL;
|
||||||
#endif
|
#endif
|
||||||
unsigned i;
|
unsigned i;
|
||||||
time_t timer = time(0);
|
time_t timer = time(NULL);
|
||||||
char tmp_str[80];
|
char tmp_str[80];
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
|
@ -255,13 +255,13 @@ int udhcpd_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
DEBUG("Received DECLINE");
|
DEBUG("Received DECLINE");
|
||||||
if (lease) {
|
if (lease) {
|
||||||
memset(lease->chaddr, 0, 16);
|
memset(lease->chaddr, 0, 16);
|
||||||
lease->expires = time(0) + server_config.decline_time;
|
lease->expires = time(NULL) + server_config.decline_time;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DHCPRELEASE:
|
case DHCPRELEASE:
|
||||||
DEBUG("Received RELEASE");
|
DEBUG("Received RELEASE");
|
||||||
if (lease)
|
if (lease)
|
||||||
lease->expires = time(0);
|
lease->expires = time(NULL);
|
||||||
break;
|
break;
|
||||||
case DHCPINFORM:
|
case DHCPINFORM:
|
||||||
DEBUG("Received INFORM");
|
DEBUG("Received INFORM");
|
||||||
|
@ -36,6 +36,7 @@ static int read_ip(const char *line, void *arg)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int read_mac(const char *line, void *arg)
|
static int read_mac(const char *line, void *arg)
|
||||||
{
|
{
|
||||||
return NULL == ether_aton_r(line, (struct ether_addr *)arg);
|
return NULL == ether_aton_r(line, (struct ether_addr *)arg);
|
||||||
@ -362,7 +363,7 @@ void FAST_FUNC write_leases(void)
|
|||||||
if (leases[i].yiaddr == 0)
|
if (leases[i].yiaddr == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* screw with the time in the struct, for easier writing */
|
/* Screw with the time in the struct, for easier writing */
|
||||||
tmp_time = leases[i].expires;
|
tmp_time = leases[i].expires;
|
||||||
|
|
||||||
leases[i].expires -= curr;
|
leases[i].expires -= curr;
|
||||||
@ -374,7 +375,7 @@ void FAST_FUNC write_leases(void)
|
|||||||
* we lose some leases on restart. Oh well. */
|
* we lose some leases on restart. Oh well. */
|
||||||
full_write(fd, &leases[i], sizeof(leases[i]));
|
full_write(fd, &leases[i], sizeof(leases[i]));
|
||||||
|
|
||||||
/* then restore it when done */
|
/* Then restore it when done */
|
||||||
leases[i].expires = tmp_time;
|
leases[i].expires = tmp_time;
|
||||||
}
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
@ -390,10 +391,10 @@ void FAST_FUNC write_leases(void)
|
|||||||
|
|
||||||
void FAST_FUNC read_leases(const char *file)
|
void FAST_FUNC read_leases(const char *file)
|
||||||
{
|
{
|
||||||
int fd;
|
|
||||||
unsigned i;
|
|
||||||
struct dhcpOfferedAddr lease;
|
struct dhcpOfferedAddr lease;
|
||||||
int64_t written_at, curr;
|
int64_t written_at, time_passed;
|
||||||
|
int fd;
|
||||||
|
USE_UDHCP_DEBUG(unsigned i;)
|
||||||
|
|
||||||
fd = open_or_warn(file, O_RDONLY);
|
fd = open_or_warn(file, O_RDONLY);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
@ -402,18 +403,19 @@ void FAST_FUNC read_leases(const char *file)
|
|||||||
if (full_read(fd, &written_at, sizeof(written_at)) != sizeof(written_at))
|
if (full_read(fd, &written_at, sizeof(written_at)) != sizeof(written_at))
|
||||||
goto ret;
|
goto ret;
|
||||||
written_at = ntoh64(written_at);
|
written_at = ntoh64(written_at);
|
||||||
curr = time(NULL);
|
|
||||||
if (curr < written_at)
|
|
||||||
written_at = curr; /* lease file from future! :) */
|
|
||||||
|
|
||||||
i = 0;
|
time_passed = time(NULL) - written_at;
|
||||||
while (i < server_config.max_leases
|
/* Strange written_at, or lease file from old version of udhcpd
|
||||||
&& full_read(fd, &lease, sizeof(lease)) == sizeof(lease)
|
* which had no "written_at" field? */
|
||||||
) {
|
if ((uint64_t)time_passed > 12 * 60 * 60)
|
||||||
|
goto ret;
|
||||||
|
|
||||||
|
USE_UDHCP_DEBUG(i = 0;)
|
||||||
|
while (full_read(fd, &lease, sizeof(lease)) == sizeof(lease)) {
|
||||||
/* ADDME: what if it matches some static lease? */
|
/* ADDME: what if it matches some static lease? */
|
||||||
uint32_t y = ntohl(lease.yiaddr);
|
uint32_t y = ntohl(lease.yiaddr);
|
||||||
if (y >= server_config.start_ip && y <= server_config.end_ip) {
|
if (y >= server_config.start_ip && y <= server_config.end_ip) {
|
||||||
int64_t expires = ntohl(lease.expires) + written_at - curr;
|
signed_leasetime_t expires = ntohl(lease.expires) - (signed_leasetime_t)time_passed;
|
||||||
if (expires <= 0)
|
if (expires <= 0)
|
||||||
continue;
|
continue;
|
||||||
/* NB: add_lease takes "relative time", IOW,
|
/* NB: add_lease takes "relative time", IOW,
|
||||||
@ -422,7 +424,7 @@ void FAST_FUNC read_leases(const char *file)
|
|||||||
bb_error_msg("too many leases while loading %s", file);
|
bb_error_msg("too many leases while loading %s", file);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
i++;
|
USE_UDHCP_DEBUG(i++;)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DEBUG("Read %d leases", i);
|
DEBUG("Read %d leases", i);
|
||||||
|
@ -445,7 +445,7 @@ int sv_main(int argc, char **argv)
|
|||||||
service = argv;
|
service = argv;
|
||||||
services = argc - 1;
|
services = argc - 1;
|
||||||
|
|
||||||
tnow = time(0) + 0x400000000000000aULL;
|
tnow = time(NULL) + 0x400000000000000aULL;
|
||||||
tstart = tnow;
|
tstart = tnow;
|
||||||
curdir = open_read(".");
|
curdir = open_read(".");
|
||||||
if (curdir == -1)
|
if (curdir == -1)
|
||||||
@ -592,7 +592,7 @@ int sv_main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
if (want_exit) break;
|
if (want_exit) break;
|
||||||
usleep(420000);
|
usleep(420000);
|
||||||
tnow = time(0) + 0x400000000000000aULL;
|
tnow = time(NULL) + 0x400000000000000aULL;
|
||||||
}
|
}
|
||||||
return rc > 99 ? 99 : rc;
|
return rc > 99 ? 99 : rc;
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ int rtcwake_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
bb_error_msg_and_die("%s not enabled for wakeup events", rtcname);
|
bb_error_msg_and_die("%s not enabled for wakeup events", rtcname);
|
||||||
|
|
||||||
/* relative or absolute alarm time, normalized to time_t */
|
/* relative or absolute alarm time, normalized to time_t */
|
||||||
sys_time = time(0);
|
sys_time = time(NULL);
|
||||||
if (sys_time == (time_t)-1)
|
if (sys_time == (time_t)-1)
|
||||||
bb_perror_msg_and_die("read system time");
|
bb_perror_msg_and_die("read system time");
|
||||||
rtc_time = rtc_read_time(fd, utc);
|
rtc_time = rtc_read_time(fd, utc);
|
||||||
|
Loading…
Reference in New Issue
Block a user