Skip to content

Commit

Permalink
* include/time.h: Declare __tzset_parse_tz and __tzset_compute.
Browse files Browse the repository at this point in the history
	* time/tzset.c (tzset_internal): Break TZ string parsing out into
	__tzset_parse_tz and updating of daylight, timezone, tzname into
	update_vars.
	(__tz_compute): Renamed from tz_compute.  Take additional parameters.
	(__tz_convert): Updating of tm_isdst, tm_zone, and tm_gmtoff now
	happens in __tz_compute.
	* time/tzfile.c (__tzfile_read): Also read TZ string.
	(find_transition): Fold into __tzfile_compute.
	(__tzfile_compute): For times beyond the last transition try to
	use the TZ string.
	* timezone/tst-timezone.c: Information in daylight and tzname does
	change for Asia/Tokyo timezone with more concrete information.
	Remove the test.

	* include/stdio.h: Add libc_hidden_proto for ftello.
	* libio/ftello.c: Add libc_hidden_def.
  • Loading branch information
Ulrich Drepper committed Oct 14, 2007
1 parent 89dc9d4 commit fa76dde
Show file tree
Hide file tree
Showing 8 changed files with 311 additions and 246 deletions.
18 changes: 18 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
2007-10-14 Ulrich Drepper <drepper@redhat.com>

* include/time.h: Declare __tzset_parse_tz and __tzset_compute.
* time/tzset.c (tzset_internal): Break TZ string parsing out into
__tzset_parse_tz and updating of daylight, timezone, tzname into
update_vars.
(__tz_compute): Renamed from tz_compute. Take additional parameters.
(__tz_convert): Updating of tm_isdst, tm_zone, and tm_gmtoff now
happens in __tz_compute.
* time/tzfile.c (__tzfile_read): Also read TZ string.
(find_transition): Fold into __tzfile_compute.
(__tzfile_compute): For times beyond the last transition try to
use the TZ string.
* timezone/tst-timezone.c: Information in daylight and tzname does
change for Asia/Tokyo timezone with more concrete information.
Remove the test.

* include/stdio.h: Add libc_hidden_proto for ftello.
* libio/ftello.c: Add libc_hidden_def.

[BZ #1140]
* time/tzfile.c (__tzfile_compute): Compute tzname[] values based
on the specified time and not the last entries in the file. Move
Expand Down
1 change: 1 addition & 0 deletions include/stdio.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ libc_hidden_proto (rewind)
libc_hidden_proto (fileno)
libc_hidden_proto (fwrite)
libc_hidden_proto (fseek)
libc_hidden_proto (ftello)
libc_hidden_proto (fflush_unlocked)
libc_hidden_proto (fread_unlocked)
libc_hidden_proto (fwrite_unlocked)
Expand Down
3 changes: 3 additions & 0 deletions include/time.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ extern void __tzfile_compute (time_t timer, int use_localtime,
struct tm *tp);
extern void __tzfile_default (const char *std, const char *dst,
long int stdoff, long int dstoff);
extern void __tzset_parse_tz (const char *tz);
extern void __tz_compute (time_t timer, struct tm *tm, int use_localtime)
__THROW internal_function;

/* Subroutine of `mktime'. Return the `time_t' representation of TP and
normalize TP, given that a `struct tm *' maps to a `time_t' as performed
Expand Down
3 changes: 2 additions & 1 deletion libio/ftello.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 1993, 1995-2001, 2002, 2003, 2004
/* Copyright (C) 1993, 1995-2001, 2002, 2003, 2004, 2007
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Expand Down Expand Up @@ -63,3 +63,4 @@ ftello (fp)
}
return pos;
}
libc_hidden_def (ftello)
40 changes: 20 additions & 20 deletions nscd/nscd_getgr_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,9 @@ nscd_getgr_r (const char *key, size_t keylen, request_type type,
retval = 0;

/* If there are no group members TOTAL_LEN is zero. */
if (total_len > 0)
if (gr_name == NULL)
{
if (gr_name == NULL)
if (total_len > 0)
{
size_t n = __readall (sock, resultbuf->gr_mem[0], total_len);
if (__builtin_expect (n != total_len, 0))
Expand All @@ -278,26 +278,26 @@ nscd_getgr_r (const char *key, size_t keylen, request_type type,
else
*result = resultbuf;
}
else
}
else
{
/* Copy the group member names. */
memcpy (resultbuf->gr_mem[0], gr_name + gr_name_len, total_len);

/* Try to detect corrupt databases. */
if (resultbuf->gr_name[gr_name_len - 1] != '\0'
|| resultbuf->gr_passwd[gr_resp.gr_passwd_len - 1] != '\0'
|| ({for (cnt = 0; cnt < gr_resp.gr_mem_cnt; ++cnt)
if (resultbuf->gr_mem[cnt][len[cnt] - 1] != '\0')
break;
cnt < gr_resp.gr_mem_cnt; }))
{
/* Copy the group member names. */
memcpy (resultbuf->gr_mem[0], gr_name + gr_name_len, total_len);

/* Try to detect corrupt databases. */
if (resultbuf->gr_name[gr_name_len - 1] != '\0'
|| resultbuf->gr_passwd[gr_resp.gr_passwd_len - 1] != '\0'
|| ({for (cnt = 0; cnt < gr_resp.gr_mem_cnt; ++cnt)
if (resultbuf->gr_mem[cnt][len[cnt] - 1] != '\0')
break;
cnt < gr_resp.gr_mem_cnt; }))
{
/* We cannot use the database. */
retval = mapped->head->gc_cycle != gc_cycle ? -2 : -1;
goto out_close;
}

*result = resultbuf;
/* We cannot use the database. */
retval = mapped->head->gc_cycle != gc_cycle ? -2 : -1;
goto out_close;
}

*result = resultbuf;
}
}
else
Expand Down
Loading

0 comments on commit fa76dde

Please sign in to comment.