~ubuntu-branches/ubuntu/precise/libmtp/precise-updates

« back to all changes in this revision

Viewing changes to src/util.c

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2011-02-10 10:43:52 UTC
  • mfrom: (1.1.14 upstream) (35 experimental)
  • mto: This revision was merged to the branch mainline in revision 36.
  • Revision ID: james.westby@ubuntu.com-20110210104352-bzqvu9r65gnp1pxl
Tags: 1.0.5-1
* Upload to unstable.
* New upstream release:
  - soname libmtp.so.8.3.5
  - several fixes from Denis Dupeyron to ease work for maintainers:
    + ./configure --enable-doxygen: make Doxygen doc generation optional.
    + ./configure --with-udev=DIR: select a dir for udev.
    + ./configure --with-udev-rules=NAME: select name of udev rules file.
  - several mtp-probe fixes for udev use, now we only probe:
    + Devices that are of known classes to conatin MTP extensions:
      COMM, PTP, CUSTOM and per-interface.
    + Unless the device is CUSTOM, it needs to contain atleast one
      CUSTOM interface.
    + Clear halt on EP 0 after probe if it fails with error.
    + Stop accepting *all* PTP devices as MTP, this is confusing.
  - Minor fixes and new devices.
* Don't build,install static libraries.
* Pass --enable-doxygen to the configure script.
* Refresh patches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
#include <errno.h>
34
34
#include <sys/stat.h>
35
35
#include <fcntl.h>
 
36
#include <string.h>
36
37
#include "libmtp.h"
37
38
#include "util.h"
38
39
 
105
106
    dump_boundry += ln;
106
107
  }
107
108
}
 
109
 
 
110
#ifndef HAVE_STRNDUP
 
111
char *strndup (const char *s, size_t n)
 
112
{
 
113
  size_t len = strlen (s);
 
114
  char *ret;
 
115
 
 
116
  if (len <= n)
 
117
    return strdup (s);
 
118
 
 
119
  ret = malloc(n + 1);
 
120
  strncpy(ret, s, n);
 
121
  ret[n] = '\0';
 
122
  return ret;
 
123
}
 
124
#endif
 
125