Ignore:
Timestamp:
Nov 27, 2012, 4:43:17 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.0

Location:
trunk/server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/source3/utils/net_time.c

    r672 r745  
    1919#include "includes.h"
    2020#include "utils/net.h"
     21#include "libsmb/nmblib.h"
     22#include "libsmb/libsmb.h"
    2123
    2224/*
     
    104106}
    105107
    106 /* try to set the system clock using /bin/date */
     108/* try to set the system clock */
    107109static int net_time_set(struct net_context *c, int argc, const char **argv)
    108110{
    109         time_t t = nettime(c, NULL);
    110         char *cmd;
     111        struct timeval tv;
    111112        int result;
    112113
    113         if (t == 0) return -1;
     114        tv.tv_sec = nettime(c, NULL);
     115        tv.tv_usec=0;
     116
     117        if (tv.tv_sec == 0) return -1;
    114118
    115119#ifdef __OS2__
    116120        /* eCS (OS/2) native "net time set" routine */
    117         result = os2_setdatetime(t);
     121        result = os2_setdatetime(tv.tv_sec);
    118122#else
    119         /* yes, I know this is cheesy. Use "net time system" if you want to
    120            roll your own. I'm putting this in as it works on a large number
    121            of systems and the user has a choice in whether its used or not */
    122         if (asprintf(&cmd, "/bin/date %s", systime(t)) == -1) {
    123                 return -1;
    124         }
    125         result = system(cmd);
     123        result = settimeofday(&tv,NULL);
    126124#endif
     125
    127126        if (result)
    128                 d_fprintf(stderr, _("%s failed.  Error was (%s)\n"),
    129                         cmd, strerror(errno));
    130         free(cmd);
     127                d_fprintf(stderr, _("setting system clock failed.  Error was (%s)\n"),
     128                        strerror(errno));
    131129
    132130        return result;
Note: See TracChangeset for help on using the changeset viewer.