Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 926999 | Differences between
and this patch

Collapse All | Expand All

(-)a/configure.ac (-1 / +1 lines)
Lines 17-23 AC_PROG_LIBTOOL Link Here
17
17
18
# Checks for libraries.
18
# Checks for libraries.
19
PKG_CHECK_MODULES(libusb, libusb-1.0 >= 1.0.9)
19
PKG_CHECK_MODULES(libusb, libusb-1.0 >= 1.0.9)
20
PKG_CHECK_MODULES(libplist, libplist-2.0 >= 2.2.0)
20
PKG_CHECK_MODULES(libplist, libplist-2.0 >= 2.3.0)
21
PKG_CHECK_MODULES(libimobiledevice, libimobiledevice-1.0 >= 1.3.0, have_limd=yes, have_limd=no)
21
PKG_CHECK_MODULES(libimobiledevice, libimobiledevice-1.0 >= 1.3.0, have_limd=yes, have_limd=no)
22
AC_CHECK_LIB(pthread, [pthread_create, pthread_mutex_lock], [AC_SUBST(libpthread_LIBS,[-lpthread])], [AC_MSG_ERROR([libpthread is required to build usbmuxd])])
22
AC_CHECK_LIB(pthread, [pthread_create, pthread_mutex_lock], [AC_SUBST(libpthread_LIBS,[-lpthread])], [AC_MSG_ERROR([libpthread is required to build usbmuxd])])
23
23
(-)a/src/conf.c (-4 / +5 lines)
Lines 39-44 Link Here
39
#include <shlobj.h>
39
#include <shlobj.h>
40
#endif
40
#endif
41
41
42
#include <plist/plist.h>
42
#include "conf.h"
43
#include "conf.h"
43
#include "utils.h"
44
#include "utils.h"
44
#include "log.h"
45
#include "log.h"
Lines 230-236 static int internal_set_value(const char *config_file, const char *key, plist_t Link Here
230
	/* read file into plist */
231
	/* read file into plist */
231
	plist_t config = NULL;
232
	plist_t config = NULL;
232
233
233
	plist_read_from_filename(&config, config_file);
234
	plist_read_from_file(config_file, &config, NULL);
234
	if (!config) {
235
	if (!config) {
235
		config = plist_new_dict();
236
		config = plist_new_dict();
236
		plist_dict_set_item(config, key, value);
237
		plist_dict_set_item(config, key, value);
Lines 254-260 static int internal_set_value(const char *config_file, const char *key, plist_t Link Here
254
		usbmuxd_log(LL_DEBUG, "Setting key %s in config file %s", key, config_file);
255
		usbmuxd_log(LL_DEBUG, "Setting key %s in config file %s", key, config_file);
255
	}
256
	}
256
257
257
	int res = plist_write_to_filename(config, config_file, PLIST_FORMAT_XML);
258
	int res = plist_write_to_file(config, config_file, PLIST_FORMAT_XML, 0);
258
259
259
	plist_free(config);
260
	plist_free(config);
260
261
Lines 288-294 static int internal_get_value(const char* config_file, const char *key, plist_t Link Here
288
289
289
	/* now parse file to get the SystemBUID */
290
	/* now parse file to get the SystemBUID */
290
	plist_t config = NULL;
291
	plist_t config = NULL;
291
	if (plist_read_from_filename(&config, config_file)) {
292
	if (plist_read_from_file(config_file, &config, NULL)) {
292
		usbmuxd_log(LL_DEBUG, "Reading key %s from config file %s", key, config_file);
293
		usbmuxd_log(LL_DEBUG, "Reading key %s from config file %s", key, config_file);
293
		plist_t n = plist_dict_get_item(config, key);
294
		plist_t n = plist_dict_get_item(config, key);
294
		if (n) {
295
		if (n) {
Lines 428-434 int config_set_device_record(const char *udid, char* record_data, uint64_t recor Link Here
428
	remove(device_record_file);
429
	remove(device_record_file);
429
430
430
	/* store file */
431
	/* store file */
431
	if (!plist_write_to_filename(plist, device_record_file, PLIST_FORMAT_XML)) {
432
	if (!plist_write_to_file(plist, device_record_file, PLIST_FORMAT_XML, 0)) {
432
		usbmuxd_log(LL_DEBUG, "Could not open '%s' for writing: %s", device_record_file, strerror(errno));
433
		usbmuxd_log(LL_DEBUG, "Could not open '%s' for writing: %s", device_record_file, strerror(errno));
433
		res = -ENOENT;
434
		res = -ENOENT;
434
	}
435
	}
(-)a/src/utils.c (-45 lines)
Lines 279-329 int buffer_write_to_filename(const char *filename, const char *buffer, uint64_t Link Here
279
	}
279
	}
280
}
280
}
281
281
282
int plist_read_from_filename(plist_t *plist, const char *filename)
283
{
284
	char *buffer = NULL;
285
	uint64_t length;
286
287
	if (!filename)
288
		return 0;
289
290
	if (!buffer_read_from_filename(filename, &buffer, &length)) {
291
		return 0;
292
	}
293
294
	if ((length > 8) && (memcmp(buffer, "bplist00", 8) == 0)) {
295
		plist_from_bin(buffer, length, plist);
296
	} else {
297
		plist_from_xml(buffer, length, plist);
298
	}
299
300
	free(buffer);
301
302
	return 1;
303
}
304
305
int plist_write_to_filename(plist_t plist, const char *filename, enum plist_format_t format)
306
{
307
	char *buffer = NULL;
308
	uint32_t length;
309
310
	if (!plist || !filename)
311
		return 0;
312
313
	if (format == PLIST_FORMAT_XML)
314
		plist_to_xml(plist, &buffer, &length);
315
	else if (format == PLIST_FORMAT_BINARY)
316
		plist_to_bin(plist, &buffer, &length);
317
	else
318
		return 0;
319
320
	int res  = buffer_write_to_filename(filename, buffer, length);
321
322
	free(buffer);
323
324
	return res;
325
}
326
327
#ifndef HAVE_CLOCK_GETTIME
282
#ifndef HAVE_CLOCK_GETTIME
328
typedef int clockid_t;
283
typedef int clockid_t;
329
#define CLOCK_MONOTONIC 1
284
#define CLOCK_MONOTONIC 1
(-)a/src/utils.h (-8 lines)
Lines 78-91 char *string_concat(const char *str, ...); Link Here
78
int buffer_read_from_filename(const char *filename, char **buffer, uint64_t *length);
78
int buffer_read_from_filename(const char *filename, char **buffer, uint64_t *length);
79
int buffer_write_to_filename(const char *filename, const char *buffer, uint64_t length);
79
int buffer_write_to_filename(const char *filename, const char *buffer, uint64_t length);
80
80
81
enum plist_format_t {
82
	PLIST_FORMAT_XML,
83
	PLIST_FORMAT_BINARY
84
};
85
86
int plist_read_from_filename(plist_t *plist, const char *filename);
87
int plist_write_to_filename(plist_t plist, const char *filename, enum plist_format_t format);
88
89
uint64_t mstime64(void);
81
uint64_t mstime64(void);
90
void get_tick_count(struct timeval * tv);
82
void get_tick_count(struct timeval * tv);
91
83

Return to bug 926999