[PATCH v1 01/12] timeserver: Add functions to store/restore timeservers set by user via the clock API.

alok barsode alokbarsode at gmail.com
Wed Feb 1 03:44:04 PST 2012


Hi Samuel,

On Wed, Feb 1, 2012 at 1:16 AM, Samuel Ortiz <sameo at linux.intel.com> wrote:

> Hi Alok,
>
> On Thu, Nov 24, 2011 at 03:28:50PM +0200, Alok Barsode wrote:
> > +char **__connman_timeserver_system_get()
> > +{
> > +     char **servers;
> > +
> > +     servers = load_timeservers();
> Can't we cache this array, and avoid accessing the filesystem (or its
> cache..)
> every time someone asks for the timeservers ?
>

The tricky bit is when we try to append a new timeserver (see
__connman_timeserver_system_append()) we use g_try_renew() to expand the
server array which might return a new address which may have been moved.
Same goes with __connman_timeserver_system_remove() where we allocate a
temp array and return a pointer to it.

This can create a race, if some piece of code is using the old pointer.


> Cheers,
> Samuel.
>
> --
> Intel Open Source Technology Centre
> http://oss.intel.com/
>

Cheers,
Alok.



More information about the connman mailing list