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/lib/util/util_file.c

    r414 r745  
    236236#endif
    237237        if (!p) {
    238                 p = file_load(fname, &s2, 0, talloc_autofree_context());
     238                p = file_load(fname, &s2, 0, NULL);
    239239                if (!p) return NULL;
    240240                if (s2 != size) {
     
    436436
    437437
     438/*
     439  compare two files, return true if the two files have the same content
     440 */
     441bool file_compare(const char *path1, const char *path2)
     442{
     443        size_t size1, size2;
     444        char *p1, *p2;
     445        TALLOC_CTX *mem_ctx = talloc_new(NULL);
     446
     447        p1 = file_load(path1, &size1, 0, mem_ctx);
     448        p2 = file_load(path2, &size2, 0, mem_ctx);
     449        if (!p1 || !p2 || size1 != size2) {
     450                talloc_free(mem_ctx);
     451                return false;
     452        }
     453        if (memcmp(p1, p2, size1) != 0) {
     454                talloc_free(mem_ctx);
     455                return false;
     456        }
     457        talloc_free(mem_ctx);
     458        return true;
     459}
Note: See TracChangeset for help on using the changeset viewer.