You can subscribe to this list here.
| 2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(76) |
Nov
(11) |
Dec
(1) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2002 |
Jan
(1) |
Feb
|
Mar
(3) |
Apr
|
May
(3) |
Jun
(1) |
Jul
(165) |
Aug
|
Sep
(15) |
Oct
(18) |
Nov
(236) |
Dec
(86) |
| 2003 |
Jan
(77) |
Feb
(78) |
Mar
(107) |
Apr
(23) |
May
(180) |
Jun
(140) |
Jul
(104) |
Aug
(173) |
Sep
(156) |
Oct
(59) |
Nov
(82) |
Dec
(97) |
| 2004 |
Jan
(53) |
Feb
|
Mar
(49) |
Apr
(42) |
May
(85) |
Jun
(37) |
Jul
(58) |
Aug
(144) |
Sep
(17) |
Oct
(28) |
Nov
(7) |
Dec
(1) |
| 2005 |
Jan
(26) |
Feb
(10) |
Mar
(77) |
Apr
(18) |
May
(23) |
Jun
(19) |
Jul
(24) |
Aug
(18) |
Sep
(12) |
Oct
(15) |
Nov
(27) |
Dec
(8) |
| 2006 |
Jan
(50) |
Feb
(112) |
Mar
(96) |
Apr
(69) |
May
(34) |
Jun
(59) |
Jul
(61) |
Aug
|
Sep
(39) |
Oct
(8) |
Nov
(79) |
Dec
(32) |
| 2007 |
Jan
(10) |
Feb
(11) |
Mar
(28) |
Apr
(58) |
May
(129) |
Jun
(6) |
Jul
(18) |
Aug
(16) |
Sep
(22) |
Oct
(16) |
Nov
(24) |
Dec
(69) |
| 2008 |
Jan
(105) |
Feb
(61) |
Mar
(52) |
Apr
(73) |
May
(40) |
Jun
(33) |
Jul
(41) |
Aug
(14) |
Sep
(27) |
Oct
(27) |
Nov
(9) |
Dec
(23) |
| 2009 |
Jan
(44) |
Feb
(7) |
Mar
(35) |
Apr
(35) |
May
(4) |
Jun
(17) |
Jul
(34) |
Aug
(9) |
Sep
(12) |
Oct
(1) |
Nov
(15) |
Dec
(18) |
| 2010 |
Jan
(11) |
Feb
(7) |
Mar
|
Apr
(23) |
May
(2) |
Jun
(4) |
Jul
(4) |
Aug
(2) |
Sep
(17) |
Oct
(5) |
Nov
(1) |
Dec
(1) |
| 2011 |
Jan
(3) |
Feb
(17) |
Mar
(34) |
Apr
(6) |
May
(1) |
Jun
(1) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
(17) |
Dec
(3) |
| 2012 |
Jan
(2) |
Feb
(4) |
Mar
|
Apr
|
May
(36) |
Jun
|
Jul
|
Aug
(14) |
Sep
(11) |
Oct
(15) |
Nov
(30) |
Dec
(5) |
| 2013 |
Jan
|
Feb
|
Mar
(7) |
Apr
(4) |
May
(8) |
Jun
(7) |
Jul
(36) |
Aug
|
Sep
|
Oct
(2) |
Nov
(3) |
Dec
(17) |
| 2014 |
Jan
(14) |
Feb
(15) |
Mar
(15) |
Apr
(8) |
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(20) |
Nov
(1) |
Dec
|
| 2017 |
Jan
(6) |
Feb
(9) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(2) |
Oct
|
Nov
|
Dec
|
| 2021 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <maj...@us...> - 2021-03-24 14:10:32
|
Revision: 4335
http://sourceforge.net/p/synce/code/4335
Author: majestro
Date: 2021-03-24 14:10:30 +0000 (Wed, 24 Mar 2021)
Log Message:
-----------
fix some type-errors caused by the python3 migration
Modified Paths:
--------------
trunk/core/ChangeLog
trunk/core/scripts/synce-serial.in
trunk/core/scripts/udev-synce-serial.in
Modified: trunk/core/ChangeLog
===================================================================
--- trunk/core/ChangeLog 2021-03-17 18:32:57 UTC (rev 4334)
+++ trunk/core/ChangeLog 2021-03-24 14:10:30 UTC (rev 4335)
@@ -1,3 +1,7 @@
+2021-03-24 Arndt Kaiser
+
+ * fix some type-errors caused by the python3 migration
+
2021-03-17 Arndt Kaiser
* migrate python scripts of core to python3
Modified: trunk/core/scripts/synce-serial.in
===================================================================
--- trunk/core/scripts/synce-serial.in 2021-03-17 18:32:57 UTC (rev 4334)
+++ trunk/core/scripts/synce-serial.in 2021-03-24 14:10:30 UTC (rev 4335)
@@ -85,7 +85,7 @@
sys.exit(1)
devnum = serial_get_devnum(device_file)
- if devnum < 0:
+ if int(devnum) < 0:
sys.exit(1)
# see the "linkname" option in the man page for pppd
Modified: trunk/core/scripts/udev-synce-serial.in
===================================================================
--- trunk/core/scripts/udev-synce-serial.in 2021-03-17 18:32:57 UTC (rev 4334)
+++ trunk/core/scripts/udev-synce-serial.in 2021-03-24 14:10:30 UTC (rev 4335)
@@ -57,7 +57,7 @@
sys.exit(1)
devnum = serial_get_devnum(device_file)
- if devnum < 0:
+ if int(devnum) < 0:
sys.exit(1)
# see the "linkname" option in the man page for pppd
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <maj...@us...> - 2021-03-17 18:32:59
|
Revision: 4334
http://sourceforge.net/p/synce/code/4334
Author: majestro
Date: 2021-03-17 18:32:57 +0000 (Wed, 17 Mar 2021)
Log Message:
-----------
migrate python scripts of core to python3
Modified Paths:
--------------
trunk/core/ChangeLog
trunk/core/bluetooth/synce-udev-bt-ipup.in
trunk/core/dccm/synce-unlock
trunk/core/python/tests/create_partnership
trunk/core/python/tests/delete_partnership
trunk/core/python/tests/list_partnerships
trunk/core/python/tests/partnerships.py
trunk/core/python/tests/util.py
trunk/core/scripts/synce-serial.in
trunk/core/scripts/synceconnector.py.in
trunk/core/scripts/udev-synce-rndis.in
trunk/core/scripts/udev-synce-serial.in
Modified: trunk/core/ChangeLog
===================================================================
--- trunk/core/ChangeLog 2019-09-03 19:05:42 UTC (rev 4333)
+++ trunk/core/ChangeLog 2021-03-17 18:32:57 UTC (rev 4334)
@@ -1,3 +1,7 @@
+2021-03-17 Arndt Kaiser
+
+ * migrate python scripts of core to python3
+
2019-09-03 Arndt Kaiser
* fix unhandled string-truncations which are detected by new
Modified: trunk/core/bluetooth/synce-udev-bt-ipup.in
===================================================================
--- trunk/core/bluetooth/synce-udev-bt-ipup.in 2019-09-03 19:05:42 UTC (rev 4333)
+++ trunk/core/bluetooth/synce-udev-bt-ipup.in 2021-03-17 18:32:57 UTC (rev 4334)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import sys
import subprocess
Modified: trunk/core/dccm/synce-unlock
===================================================================
--- trunk/core/dccm/synce-unlock 2019-09-03 19:05:42 UTC (rev 4333)
+++ trunk/core/dccm/synce-unlock 2021-03-17 18:32:57 UTC (rev 4334)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# A simple script to provide a password to a locked Windows
# Mobile device from the command line
@@ -8,9 +8,9 @@
import sys
import getopt
-DBUS_DBUS_BUSNAME = "org.freedesktop.DBus"
-DBUS_DBUS_IFACE = "org.freedesktop.DBus"
-DBUS_DBUS_OBJPATH = "/org/freedesktop/DBus"
+DBUS_DBUS_BUSNAME = "org.freedesktop.DBus"
+DBUS_DBUS_IFACE = "org.freedesktop.DBus"
+DBUS_DBUS_OBJPATH = "/org/freedesktop/DBus"
DBUS_DCCM_BUSNAME = "org.synce.dccm"
DBUS_DCCM_MANAGER_IFACE = "org.synce.dccm.DeviceManager"
@@ -30,102 +30,102 @@
def unlock_device(device_path, password):
- device = dbus.Interface(dbus.SystemBus().get_object(DBUS_DCCM_BUSNAME, device_path), DBUS_DCCM_DEVICE_IFACE)
+ device = dbus.Interface(dbus.SystemBus().get_object(DBUS_DCCM_BUSNAME, device_path), DBUS_DCCM_DEVICE_IFACE)
- deviceName = device.GetName()
- print "Unlocking device connected at path %s with name %s" % (device_path, deviceName)
+ deviceName = device.GetName()
+ print("Unlocking device connected at path %s with name %s" % (device_path, deviceName))
- pw_flags = device.GetPasswordFlags()
- if pw_flags == DCCM_DEVICE_PASSWORD_FLAG_UNSET or pw_flags == DCCM_DEVICE_PASSWORD_FLAG_UNLOCKED:
- print "No password required"
- return 0
+ pw_flags = device.GetPasswordFlags()
+ if pw_flags == DCCM_DEVICE_PASSWORD_FLAG_UNSET or pw_flags == DCCM_DEVICE_PASSWORD_FLAG_UNLOCKED:
+ print("No password required")
+ return 0
- if pw_flags == DCCM_DEVICE_PASSWORD_FLAG_PROVIDE_ON_DEVICE:
- print "WM6 device requires password on device"
- return 2
+ if pw_flags == DCCM_DEVICE_PASSWORD_FLAG_PROVIDE_ON_DEVICE:
+ print("WM6 device requires password on device")
+ return 2
- if pw_flags == DCCM_DEVICE_PASSWORD_FLAG_CHECKING:
- print "aError: an authorization attempt is already in progress"
- return 2
+ if pw_flags == DCCM_DEVICE_PASSWORD_FLAG_CHECKING:
+ print("aError: an authorization attempt is already in progress")
+ return 2
- print "Authorization required for device %s." % deviceName
+ print("Authorization required for device %s." % deviceName)
- rc = device.ProvidePassword(password)
- if (rc == True):
- print "Authorization succeeded"
- return 0
+ rc = device.ProvidePassword(password)
+ if (rc == True):
+ print("Authorization succeeded")
+ return 0
- print "Authorization failed"
- return 1
+ print("Authorization failed")
+ return 1
def usage():
- print "Usage: %s [ -d <device-name> ] [ -p ] [ <password> ]" % sys.argv[0]
+ print("Usage: %s [ -d <device-name> ] [ -p ] [ <password> ]" % sys.argv[0])
if __name__ == "__main__":
- try:
- opts, args = getopt.getopt(sys.argv[1:], "d:p", ["device-name="])
+ try:
+ opts, args = getopt.getopt(sys.argv[1:], "d:p", ["device-name="])
- except getopt.GetoptError:
- usage()
- sys.exit(2)
+ except getopt.GetoptError:
+ usage()
+ sys.exit(2)
- device_name = None
- password_prompt = False
- password = None
+ device_name = None
+ password_prompt = False
+ password = None
- for o, a in opts:
- if o in ("-d", "--device-name"):
- device_name = a
- elif o == "-p":
- password_prompt = True
- password = raw_input("Enter password: ")
- else:
- usage()
- sys.exit(2)
+ for o, a in opts:
+ if o in ("-d", "--device-name"):
+ device_name = a
+ elif o == "-p":
+ password_prompt = True
+ password = input("Enter password: ")
+ else:
+ usage()
+ sys.exit(2)
- if len(args) > 1:
- print "Too many arguments"
- usage()
- sys.exit(2)
+ if len(args) > 1:
+ print("Too many arguments")
+ usage()
+ sys.exit(2)
- if password_prompt == True and len(args) > 0:
- print "Too many arguments"
- usage()
- sys.exit(2)
+ if password_prompt == True and len(args) > 0:
+ print("Too many arguments")
+ usage()
+ sys.exit(2)
- if password_prompt == False and len(args) < 1:
- usage()
- sys.exit(2)
+ if password_prompt == False and len(args) < 1:
+ usage()
+ sys.exit(2)
- if password == None:
- password = args[0]
+ if password == None:
+ password = args[0]
- device_manager = dbus.Interface(dbus.SystemBus().get_object(DBUS_DCCM_BUSNAME, DBUS_DCCM_MANAGER_OBJPATH), DBUS_DCCM_MANAGER_IFACE)
- obj_paths = device_manager.GetConnectedDevices()
- if len(obj_paths) == 0:
- print "No connected devices found"
- sys.exit(2)
+ device_manager = dbus.Interface(dbus.SystemBus().get_object(DBUS_DCCM_BUSNAME, DBUS_DCCM_MANAGER_OBJPATH), DBUS_DCCM_MANAGER_IFACE)
+ obj_paths = device_manager.GetConnectedDevices()
+ if len(obj_paths) == 0:
+ print("No connected devices found")
+ sys.exit(2)
- found_device = None
- for device_path in obj_paths:
- device = dbus.Interface(dbus.SystemBus().get_object(DBUS_DCCM_BUSNAME, device_path), DBUS_DCCM_DEVICE_IFACE)
+ found_device = None
+ for device_path in obj_paths:
+ device = dbus.Interface(dbus.SystemBus().get_object(DBUS_DCCM_BUSNAME, device_path), DBUS_DCCM_DEVICE_IFACE)
- if device_name == None:
- found_device = device_path
- break
+ if device_name == None:
+ found_device = device_path
+ break
- deviceName = device.GetName()
- if deviceName == device_name:
- found_device = device_path
- break
+ deviceName = device.GetName()
+ if deviceName == device_name:
+ found_device = device_path
+ break
- if found_device == None:
- print "Device not found"
- sys.exit(2)
+ if found_device == None:
+ print("Device not found")
+ sys.exit(2)
- rc = unlock_device(found_device, password)
+ rc = unlock_device(found_device, password)
- sys.exit(rc)
+ sys.exit(rc)
Modified: trunk/core/python/tests/create_partnership
===================================================================
--- trunk/core/python/tests/create_partnership 2019-09-03 19:05:42 UTC (rev 4333)
+++ trunk/core/python/tests/create_partnership 2021-03-17 18:32:57 UTC (rev 4334)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import sys
from pyrapi2 import *
@@ -5,10 +5,9 @@
from partnerships import *
if len(sys.argv) != 3:
- print "Invalid argument count"
+ print("Invalid argument count")
sys.exit(1)
s = RAPISession(SYNCE_LOG_LEVEL_DEFAULT)
create_partnership(s, sys.argv[1], sys.argv[2].split(","))
-
Modified: trunk/core/python/tests/delete_partnership
===================================================================
--- trunk/core/python/tests/delete_partnership 2019-09-03 19:05:42 UTC (rev 4333)
+++ trunk/core/python/tests/delete_partnership 2021-03-17 18:32:57 UTC (rev 4334)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import sys
from pyrapi2 import *
@@ -5,12 +5,12 @@
from partnerships import *
if len(sys.argv) != 2:
- print "Invalid argument count"
+ print("Invalid argument count")
sys.exit(1)
slot = int(sys.argv[1])
if not slot in (1, 2):
- print "Invalid partnership id (must be either 1 or 2)"
+ print("Invalid partnership id (must be either 1 or 2)")
sys.exit(1)
s = RAPISession(SYNCE_LOG_LEVEL_DEFAULT)
@@ -17,12 +17,11 @@
partnership = get_partnerships(s)[slot-1]
if partnership == None:
- print "Partnership does not exist"
+ print("Partnership does not exist")
sys.exit(1)
-print "Found:", partnership
+print("Found:", partnership)
-print "Deleting partnership...",
+print("Deleting partnership...", end=' ')
delete_partnership(s, partnership)
-print "done"
-
+print("done")
Modified: trunk/core/python/tests/list_partnerships
===================================================================
--- trunk/core/python/tests/list_partnerships 2019-09-03 19:05:42 UTC (rev 4333)
+++ trunk/core/python/tests/list_partnerships 2021-03-17 18:32:57 UTC (rev 4334)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
from pyrapi2 import *
from partnerships import *
@@ -8,8 +8,7 @@
i = 1
for partnership in get_partnerships(s):
if partnership != None:
- print "%d: %s" % (i, partnership)
+ print("%d: %s" % (i, partnership))
else:
- print "%d: [slot empty]" % i
+ print("%d: [slot empty]" % i)
i += 1
-
Modified: trunk/core/python/tests/partnerships.py
===================================================================
--- trunk/core/python/tests/partnerships.py 2019-09-03 19:05:42 UTC (rev 4333)
+++ trunk/core/python/tests/partnerships.py 2021-03-17 18:32:57 UTC (rev 4334)
@@ -39,7 +39,7 @@
hklm = session.HKEY_LOCAL_MACHINE
partners_key = hklm.create_sub_key(
r"Software\Microsoft\Windows CE Services\Partners")
- for pos in xrange(1, 3):
+ for pos in range(1, 3):
key = partners_key.create_sub_key("P%d" % pos)
if key.disposition == REG_OPENED_EXISTING_KEY:
try:
@@ -54,7 +54,7 @@
partners_key.close()
# Look up the synchronization data on each
- for ctic in config_query_get(session, "Sync", "Sources").children.values():
+ for ctic in list(config_query_get(session, "Sync", "Sources").children.values()):
sub_ctic = config_query_get(session, "Sync.Sources", ctic.type, recursive=True)
guid = sub_ctic.type
@@ -69,19 +69,19 @@
partnerships[pos - 1] = pship
engine = sub_ctic.children["Engines"].children[GUID_WM5_ENGINE]
- for provider in engine.children["Providers"].children.values():
+ for provider in list(engine.children["Providers"].children.values()):
if int(provider["Enabled"]) != 0:
pship.sync_items.append(SYNC_ITEM_ID_FROM_GUID[provider.type])
else:
sync_entries.append((guid, hostname, description))
- for entry in reg_entries.values():
- print "deleting dangling registry entry:", entry
+ for entry in list(reg_entries.values()):
+ print("deleting dangling registry entry:", entry)
hklm.delete_sub_key(
r"Software\Microsoft\Windows CE Services\Partners\P%d" % entry[0])
for entry in sync_entries:
- print "deleting dangling sync source:", entry
+ print("deleting dangling sync source:", entry)
config_query_remove(session, "Sync.Sources", entry[0])
return partnerships
@@ -98,14 +98,14 @@
if slot == None:
raise NoFreeSlotsError("all slots are currently full")
- print "adding to slot %d" % slot
+ print("adding to slot %d" % slot)
id = generate_id()
guid = generate_guid()
hostname = socket.gethostname()
- print "generated id: %#x" % id
- print "generated guid: '%s'" % guid
+ print("generated id: %#x" % id)
+ print("generated guid: '%s'" % guid)
#
# Create the synchronization config data source
@@ -134,7 +134,7 @@
providers = Characteristic("Providers")
engine.add_child(providers)
- for item_id, item_rec in SYNC_ITEMS.items():
+ for item_id, item_rec in list(SYNC_ITEMS.items()):
item_str, item_readonly = item_rec
item_guid = SYNC_ITEM_ID_TO_GUID[item_id]
item_enabled = (str(item_id) in sync_items)
@@ -166,4 +166,3 @@
def delete_partnership(session, partnership):
config_query_remove(session, "Sync.Sources", partnership.guid)
-
Modified: trunk/core/python/tests/util.py
===================================================================
--- trunk/core/python/tests/util.py 2019-09-03 19:05:42 UTC (rev 4333)
+++ trunk/core/python/tests/util.py 2021-03-17 18:32:57 UTC (rev 4334)
@@ -37,12 +37,12 @@
indent = "%*s" % (4 * level, "")
str = "%s* %s\n" % (indent, self.type)
if self.params:
- for name, value in self.params.items():
+ for name, value in list(self.params.items()):
str += "%s %s = %s\n" % (indent, name, value)
else:
str += "%s [no params]\n" % indent
- for child in self.children.values():
+ for child in list(self.children.values()):
str += "\n"
str += child.to_string(level + 1)
@@ -67,7 +67,7 @@
elif node.localName == "parm":
ctic[node.getAttribute("name")] = node.getAttribute("value")
else:
- print "unhandled node '%s'" % node.localName
+ print("unhandled node '%s'" % node.localName)
return ctic
@@ -75,10 +75,10 @@
node = doc.createElement("characteristic")
node.setAttribute("type", ctic.type)
- for child in ctic.children.values():
+ for child in list(ctic.children.values()):
characteristic_to_xml(child, doc, node)
- for name, value in ctic.params.items():
+ for name, value in list(ctic.params.items()):
parm = doc.createElement("parm")
parm.setAttribute("name", name)
parm.setAttribute("value", value)
@@ -126,15 +126,15 @@
parent.appendChild(node)
if os.getenv("SYNCE_DEBUG"):
- print "CeProcessConfig request:"
- print doc_node.toprettyxml()
+ print("CeProcessConfig request:")
+ print(doc_node.toprettyxml())
reply = session.process_config(doc_node.toxml(), 1)
reply_doc = minidom.parseString(reply)
if os.getenv("SYNCE_DEBUG"):
- print "CeProcessConfig response:"
- print reply_doc.documentElement.toprettyxml()
+ print("CeProcessConfig response:")
+ print(reply_doc.documentElement.toprettyxml())
reply_node = get_node_on_level(reply_doc, 2 + len(tokens))
@@ -157,7 +157,7 @@
d4.append(random.randint(0, 0xFF))
guid = "{%08X-%04X-%04X-" % (d1, d2, d3)
- for i in xrange(len(d4)):
+ for i in range(len(d4)):
guid += "%02X" % d4[i]
if i == 1:
guid += "-"
@@ -164,4 +164,3 @@
guid += "}"
return guid
-
Modified: trunk/core/scripts/synce-serial.in
===================================================================
--- trunk/core/scripts/synce-serial.in 2019-09-03 19:05:42 UTC (rev 4333)
+++ trunk/core/scripts/synce-serial.in 2021-03-17 18:32:57 UTC (rev 4334)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# Some serial devices will not be picked up automatically by synce,
# eg those on a serial to usb bridge. This tool will initiate connection.
@@ -12,7 +12,7 @@
import subprocess
import logging, logging.handlers
import platform
-import ConfigParser
+import configparser
import dbus
import gi
@@ -24,14 +24,14 @@
from synceconnector import signal_dccm_connect, process_config, get_logger, serial_stop_device, serial_start_device, serial_get_address, serial_get_devnum
def print_usage():
- print "Usage:"
- print "------\n"
- print "synce-serial <action> <device_file>"
- print "\nwhere:\n"
- print "<action> - add or remove, to start or bring down the connection"
- print "<device_file> - the device file for the connected device, eg. /dev/ttyS1"
- print "For example:"
- print " synce-serial add /dev/ttyS1\n"
+ print("Usage:")
+ print("------\n")
+ print("synce-serial <action> <device_file>")
+ print("\nwhere:\n")
+ print("<action> - add or remove, to start or bring down the connection")
+ print("<device_file> - the device file for the connected device, eg. /dev/ttyS1")
+ print("For example:")
+ print(" synce-serial add /dev/ttyS1\n")
#
@@ -40,13 +40,13 @@
if __name__ == '__main__':
if os.geteuid() != 0:
- print "\nError: must be run as root\n"
- sys.exit(1)
+ print("\nError: must be run as root\n")
+ sys.exit(1)
if len(sys.argv) != 3:
- print "\nError: invalid argument count\n"
- print_usage()
- sys.exit(1)
+ print("\nError: invalid argument count\n")
+ print_usage()
+ sys.exit(1)
logger = get_logger("synce-serial-start")
@@ -60,7 +60,7 @@
action = sys.argv[1]
if action != "add" and action != "remove":
- print "\nError: invalid action\n"
+ print("\nError: invalid action\n")
print_usage()
sys.exit(1)
@@ -70,7 +70,7 @@
device = udev_client.query_by_device_file(device_file)
if device == None:
logger.critical("Failed to find device "+device_file+" in udev")
- sys.exit(1)
+ sys.exit(1)
if device.has_property("DEVPATH"):
device_path = device.get_property("DEVPATH")
@@ -98,7 +98,7 @@
if stat.S_ISCHR(os.stat(device_file).st_mode) == 0:
logger.critical("unable to find a character device named "+device_file)
sys.exit(1)
- except Exception,e:
+ except Exception as e:
logger.critical("Error stat'ing device file %s: %s" % (device_file, e))
sys.exit(1)
Modified: trunk/core/scripts/synceconnector.py.in
===================================================================
--- trunk/core/scripts/synceconnector.py.in 2019-09-03 19:05:42 UTC (rev 4333)
+++ trunk/core/scripts/synceconnector.py.in 2021-03-17 18:32:57 UTC (rev 4334)
@@ -7,7 +7,7 @@
import re
import subprocess
import logging, logging.handlers
-import ConfigParser
+import configparser
import dbus
DBUS_DBUS_BUSNAME = "org.freedesktop.DBus"
@@ -73,7 +73,7 @@
try:
proc = subprocess.Popen(cmd_list, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
output_text = proc.communicate()[0]
- except Exception,e:
+ except Exception as e:
logger.error("failure running ifconfig: %s" % e)
return False, False
@@ -111,7 +111,7 @@
try:
proc = subprocess.Popen(cmd_list, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
output_text = proc.communicate()[0]
- except Exception,e:
+ except Exception as e:
logger.error("failure running dhclient: %s" % e)
return False, False
@@ -163,7 +163,7 @@
try:
proc = subprocess.Popen(cmd_list, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
output_text = proc.communicate()[0]
- except Exception,e:
+ except Exception as e:
logger.error("failure running dhclient: %s" % e)
return True
@@ -220,13 +220,13 @@
f = open(pidfile, 'r')
textpid = f.readline().rstrip()
f.close()
- except Exception, e:
+ except Exception as e:
logger.warning("unable to read PID from %s: %s", pidfile, e)
return False
try:
pid = int(textpid)
- except Exception, e:
+ except Exception as e:
logger.error("found invalid PID in %s: %s", pidfile, e)
return False
@@ -234,7 +234,7 @@
try:
os.kill(pid, signal.SIGTERM)
- except Exception,e:
+ except Exception as e:
logger.error("unable stop the SynCE connection with PID %d: %s", pid, e)
return False
@@ -273,7 +273,7 @@
try:
proc = subprocess.Popen(cmd_list, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
output_text = proc.communicate()[0]
- except Exception,e:
+ except Exception as e:
logger.error("failure running pppd: %s" % e)
return False
@@ -311,7 +311,7 @@
try:
os.execv("@LIBEXECDIR@/dccm", cmd_list)
- except Exception,e:
+ except Exception as e:
logger.error("failed to exec dccm !!: %s" % e)
return
@@ -335,7 +335,7 @@
try:
dccm_manager = dbus.Interface(dbus.SystemBus().get_object(DBUS_SYNCE_BUSNAME, DBUS_SYNCE_MANAGER_OBJPATH), DBUS_SYNCE_MANAGER_IFACE)
- except Exception,e:
+ except Exception as e:
logger.critical("failed to connect to dccm device manager %s: %s" % (device_path, e))
return False
@@ -344,12 +344,12 @@
rndis_text = "True"
else:
rndis_text = "False"
-
+
logger.debug("device-path=%s, device-ip=%s, local-ip=%s, rndis=%s" % (device_path, device_ip, local_ip, rndis_text))
try:
dccm_manager.DeviceConnected(device_path, device_ip, local_ip, rndis)
- except Exception, e:
+ except Exception as e:
logger.critical("failed to signal device connect to dccm device manager %s: %s" % (DBUS_SYNCE_MANAGER_OBJPATH, e))
return False
@@ -374,7 +374,7 @@
try:
dccm_manager = dbus.Interface(dbus.SystemBus().get_object(DBUS_SYNCE_BUSNAME, DBUS_SYNCE_MANAGER_OBJPATH), DBUS_SYNCE_MANAGER_IFACE)
- except Exception,e:
+ except Exception as e:
logger.critical("failed to connect to dccm device manager %s: %s" % (device_path, e))
return False
@@ -383,7 +383,7 @@
try:
dccm_manager.DeviceDisconnected(device_path)
- except Exception, e:
+ except Exception as e:
logger.critical("failed to signal device disconnect to dccm device manager %s: %s" % (DBUS_SYNCE_MANAGER_OBJPATH, e))
return False
@@ -400,10 +400,10 @@
global DEFAULT_SERIAL_NETWORK
global pppopts
- config = ConfigParser.ConfigParser()
+ config = configparser.ConfigParser()
try:
config.read(config_file)
- except Exception,e:
+ except Exception as e:
logger.warning("failed to parse config file %s: %s" % (config_file, e))
return False
@@ -426,7 +426,7 @@
if config.has_option('rndis', 'static_device_ip'):
new_ip = config.get('rndis', 'static_device_ip')
-
+
ip_re = re.compile('^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$)')
ip_match = ip_re.match(new_ip)
if ip_match != None:
@@ -436,7 +436,7 @@
if config.has_option('rndis', 'static_local_ip'):
new_ip = config.get('rndis', 'static_local_ip')
-
+
ip_re = re.compile('^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$)')
ip_match = ip_re.match(new_ip)
if ip_match != None:
@@ -446,7 +446,7 @@
if config.has_option('rndis', 'static_netmask'):
new_ip = config.get('rndis', 'static_netmask')
-
+
ip_re = re.compile('^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$)')
ip_match = ip_re.match(new_ip)
if ip_match != None:
@@ -456,7 +456,7 @@
if config.has_option('rndis', 'static_broadcast'):
new_ip = config.get('rndis', 'static_broadcast')
-
+
ip_re = re.compile('^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$)')
ip_match = ip_re.match(new_ip)
if ip_match != None:
@@ -471,7 +471,7 @@
if config.has_option('serial', 'network'):
new_network = config.get('serial', 'network')
-
+
network_re = re.compile('^(\d{1,3}\.\d{1,3}\.\d{1,3}$)')
network_match = network_re.match(new_network)
if network_match != None:
@@ -480,6 +480,3 @@
logger.warning("found invalid network in config file %s: %s" % (config_file, new_network))
return True
-
-
-
Modified: trunk/core/scripts/udev-synce-rndis.in
===================================================================
--- trunk/core/scripts/udev-synce-rndis.in 2019-09-03 19:05:42 UTC (rev 4333)
+++ trunk/core/scripts/udev-synce-rndis.in 2021-03-17 18:32:57 UTC (rev 4334)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import sys
import os
@@ -20,16 +20,16 @@
device_ip = False
local_ip = False
- if os.environ.has_key("ACTION"):
+ if "ACTION" in os.environ:
action = os.environ["ACTION"]
- if os.environ.has_key("INTERFACE"):
+ if "INTERFACE" in os.environ:
iface = os.environ["INTERFACE"]
else:
logger.critical("Udev environment not set: INTERFACE missing")
sys.exit(1)
- if os.environ.has_key("DEVPATH"):
+ if "DEVPATH" in os.environ:
device_path = os.environ["DEVPATH"]
else:
logger.critical("Udev environment not set: DEVPATH missing")
@@ -68,4 +68,3 @@
rndis_dhcp_unconfig(iface)
sys.exit(0)
-
Modified: trunk/core/scripts/udev-synce-serial.in
===================================================================
--- trunk/core/scripts/udev-synce-serial.in 2019-09-03 19:05:42 UTC (rev 4333)
+++ trunk/core/scripts/udev-synce-serial.in 2021-03-17 18:32:57 UTC (rev 4334)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import sys
import os
@@ -8,7 +8,7 @@
import subprocess
import logging, logging.handlers
import platform
-import ConfigParser
+import configparser
import dbus
sys.path.insert(0,"@SYNCEDATADIR@")
@@ -26,16 +26,16 @@
device_path = False
- if os.environ.has_key("ACTION"):
+ if "ACTION" in os.environ:
action = os.environ["ACTION"]
- if os.environ.has_key("DEVPATH"):
+ if "DEVPATH" in os.environ:
device_path = os.environ["DEVPATH"]
else:
logger.critical("Udev environment not set: DEVPATH missing")
sys.exit(1)
- if os.environ.has_key("SUBSYSTEM"):
+ if "SUBSYSTEM" in os.environ:
subsystem = os.environ["SUBSYSTEM"]
else:
logger.critical("Udev environment not set: SUBSYSTEM missing")
@@ -48,7 +48,7 @@
else:
try:
device_file = os.environ["DEVNAME"]
- except Exception,e:
+ except Exception as e:
logger.critical("Udev environment not set: DEVNAME missing")
sys.exit(1)
@@ -70,7 +70,7 @@
if stat.S_ISCHR(os.stat(device_file).st_mode) == 0:
logger.critical("unable to find a character device named "+device_file)
sys.exit(1)
- except Exception,e:
+ except Exception as e:
logger.critical("Error stat'ing device file %s: %s" % (device_file, e))
sys.exit(1)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <maj...@us...> - 2019-09-03 19:05:44
|
Revision: 4333
http://sourceforge.net/p/synce/code/4333
Author: majestro
Date: 2019-09-03 19:05:42 +0000 (Tue, 03 Sep 2019)
Log Message:
-----------
replace g_type_class_add_private() with the instance private data macros G_DEFINE_TYPE_WITH_PRIVATE or G_ADD_PRIVATE because it's deprecated since GLib 2.58
Modified Paths:
--------------
trunk/core/ChangeLog
trunk/core/dccm/synce-connection-broker.c
trunk/core/dccm/synce-device-legacy.c
trunk/core/dccm/synce-device-manager-control.c
trunk/core/dccm/synce-device-manager.c
trunk/core/dccm/synce-device-rndis.c
trunk/core/dccm/synce-device.c
Modified: trunk/core/ChangeLog
===================================================================
--- trunk/core/ChangeLog 2019-09-03 18:41:59 UTC (rev 4332)
+++ trunk/core/ChangeLog 2019-09-03 19:05:42 UTC (rev 4333)
@@ -2,6 +2,9 @@
* fix unhandled string-truncations which are detected by new
gcc compiler versions
+ * replace g_type_class_add_private() with the instance private
+ data macros G_DEFINE_TYPE_WITH_PRIVATE or G_ADD_PRIVATE
+ because it's deprecated since GLib 2.58
2019-08-20 Arndt Kaiser
Modified: trunk/core/dccm/synce-connection-broker.c
===================================================================
--- trunk/core/dccm/synce-connection-broker.c 2019-09-03 18:41:59 UTC (rev 4332)
+++ trunk/core/dccm/synce-connection-broker.c 2019-09-03 19:05:42 UTC (rev 4333)
@@ -16,8 +16,6 @@
#include "utils.h"
-G_DEFINE_TYPE (SynceConnectionBroker, synce_connection_broker, G_TYPE_OBJECT)
-
/* properties */
enum
{
@@ -51,6 +49,8 @@
GSocketService *server;
};
+G_DEFINE_TYPE_WITH_PRIVATE (SynceConnectionBroker, synce_connection_broker, G_TYPE_OBJECT)
+
#define SYNCE_CONNECTION_BROKER_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE((o), SYNCE_TYPE_CONNECTION_BROKER, SynceConnectionBrokerPrivate))
@@ -152,9 +152,6 @@
GObjectClass *obj_class = G_OBJECT_CLASS (conn_broker_class);
GParamSpec *param_spec;
- g_type_class_add_private (conn_broker_class,
- sizeof (SynceConnectionBrokerPrivate));
-
obj_class->get_property = synce_connection_broker_get_property;
obj_class->set_property = synce_connection_broker_set_property;
Modified: trunk/core/dccm/synce-device-legacy.c
===================================================================
--- trunk/core/dccm/synce-device-legacy.c 2019-09-03 18:41:59 UTC (rev 4332)
+++ trunk/core/dccm/synce-device-legacy.c 2019-09-03 19:05:42 UTC (rev 4333)
@@ -15,8 +15,6 @@
#include "synce_gerrors.h"
#include "utils.h"
-G_DEFINE_TYPE(SynceDeviceLegacy, synce_device_legacy, SYNCE_TYPE_DEVICE)
-
typedef struct _SynceDeviceLegacyPrivate SynceDeviceLegacyPrivate;
struct _SynceDeviceLegacyPrivate {
gint ping_count;
@@ -25,6 +23,8 @@
GInetSocketAddress *rapi_address;
};
+G_DEFINE_TYPE_WITH_PRIVATE (SynceDeviceLegacy, synce_device_legacy, SYNCE_TYPE_DEVICE)
+
#define SYNCE_DEVICE_LEGACY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SYNCE_TYPE_DEVICE_LEGACY, SynceDeviceLegacyPrivate))
typedef struct _PendingClientInfo PendingClientInfo;
@@ -637,8 +637,6 @@
gobject_class->dispose = synce_device_legacy_dispose;
gobject_class->finalize = synce_device_legacy_finalize;
- g_type_class_add_private (klass, sizeof (SynceDeviceLegacyPrivate));
-
synce_device_class->synce_device_conn_event_cb = synce_device_legacy_conn_event_cb_impl;
synce_device_class->synce_device_request_connection = synce_device_legacy_request_connection_impl;
synce_device_class->synce_device_provide_password = synce_device_legacy_provide_password_impl;
Modified: trunk/core/dccm/synce-device-manager-control.c
===================================================================
--- trunk/core/dccm/synce-device-manager-control.c 2019-09-03 18:41:59 UTC (rev 4332)
+++ trunk/core/dccm/synce-device-manager-control.c 2019-09-03 19:05:42 UTC (rev 4333)
@@ -21,10 +21,6 @@
GAsyncResult *res,
GError **error);
-G_DEFINE_TYPE_WITH_CODE (SynceDeviceManagerControl, synce_device_manager_control, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, synce_device_manager_control_initable_iface_init)
- G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, synce_device_manager_control_async_initable_iface_init))
-
enum {
NOT_INITIALISED,
INITIALISING,
@@ -45,6 +41,11 @@
SynceDbusDeviceManagerControl *interface;
};
+G_DEFINE_TYPE_WITH_CODE (SynceDeviceManagerControl, synce_device_manager_control, G_TYPE_OBJECT,
+ G_ADD_PRIVATE (SynceDeviceManagerControl)
+ G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, synce_device_manager_control_initable_iface_init)
+ G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, synce_device_manager_control_async_initable_iface_init))
+
#define SYNCE_DEVICE_MANAGER_CONTROL_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE((o), SYNCE_TYPE_DEVICE_MANAGER_CONTROL, SynceDeviceManagerControlPrivate))
@@ -327,8 +328,6 @@
{
GObjectClass *obj_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (SynceDeviceManagerControlPrivate));
-
obj_class->dispose = synce_device_manager_control_dispose;
obj_class->finalize = synce_device_manager_control_finalize;
Modified: trunk/core/dccm/synce-device-manager.c
===================================================================
--- trunk/core/dccm/synce-device-manager.c 2019-09-03 18:41:59 UTC (rev 4332)
+++ trunk/core/dccm/synce-device-manager.c 2019-09-03 19:05:42 UTC (rev 4333)
@@ -32,10 +32,6 @@
const gchar *udev_subsystems[] = { NULL };
-G_DEFINE_TYPE_WITH_CODE (SynceDeviceManager, synce_device_manager, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, synce_device_manager_initable_iface_init)
- G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, synce_device_manager_async_initable_iface_init))
-
/* private stuff */
typedef struct
@@ -77,6 +73,11 @@
SynceDbusDeviceManager *interface;
};
+G_DEFINE_TYPE_WITH_CODE (SynceDeviceManager, synce_device_manager, G_TYPE_OBJECT,
+ G_ADD_PRIVATE (SynceDeviceManager)
+ G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, synce_device_manager_initable_iface_init)
+ G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, synce_device_manager_async_initable_iface_init))
+
#define SYNCE_DEVICE_MANAGER_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE((o), SYNCE_TYPE_DEVICE_MANAGER, SynceDeviceManagerPrivate))
@@ -935,8 +936,6 @@
{
GObjectClass *obj_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (SynceDeviceManagerPrivate));
-
obj_class->dispose = synce_device_manager_dispose;
obj_class->finalize = synce_device_manager_finalize;
Modified: trunk/core/dccm/synce-device-rndis.c
===================================================================
--- trunk/core/dccm/synce-device-rndis.c 2019-09-03 18:41:59 UTC (rev 4332)
+++ trunk/core/dccm/synce-device-rndis.c 2019-09-03 19:05:42 UTC (rev 4333)
@@ -14,13 +14,13 @@
#include "synce_gerrors.h"
#include "utils.h"
-G_DEFINE_TYPE(SynceDeviceRndis, synce_device_rndis, SYNCE_TYPE_DEVICE)
-
typedef struct _SynceDeviceRndisPrivate SynceDeviceRndisPrivate;
struct _SynceDeviceRndisPrivate {
GHashTable *pending_client_conns;
};
+G_DEFINE_TYPE_WITH_PRIVATE (SynceDeviceRndis, synce_device_rndis, SYNCE_TYPE_DEVICE)
+
#define SYNCE_DEVICE_RNDIS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SYNCE_TYPE_DEVICE_RNDIS, SynceDeviceRndisPrivate))
/* methods */
@@ -626,8 +626,6 @@
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
SynceDeviceClass *synce_device_class = SYNCE_DEVICE_CLASS(klass);
- g_type_class_add_private (klass, sizeof (SynceDeviceRndisPrivate));
-
gobject_class->dispose = synce_device_rndis_dispose;
gobject_class->finalize = synce_device_rndis_finalize;
Modified: trunk/core/dccm/synce-device.c
===================================================================
--- trunk/core/dccm/synce-device.c 2019-09-03 18:41:59 UTC (rev 4332)
+++ trunk/core/dccm/synce-device.c 2019-09-03 19:05:42 UTC (rev 4333)
@@ -14,7 +14,7 @@
#include "synce-device-dbus.h"
#include "synce_gerrors.h"
-G_DEFINE_TYPE (SynceDevice, synce_device, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (SynceDevice, synce_device, G_TYPE_OBJECT)
/* properties */
@@ -744,8 +744,6 @@
GObjectClass *obj_class = G_OBJECT_CLASS (klass);
GParamSpec *param_spec;
- g_type_class_add_private (klass, sizeof (SynceDevicePrivate));
-
obj_class->get_property = synce_device_get_property;
obj_class->set_property = synce_device_set_property;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <maj...@us...> - 2019-09-03 18:42:01
|
Revision: 4332
http://sourceforge.net/p/synce/code/4332
Author: majestro
Date: 2019-09-03 18:41:59 +0000 (Tue, 03 Sep 2019)
Log Message:
-----------
fix unhandled string-truncations which are detected by new gcc compiler versions
Modified Paths:
--------------
trunk/core/ChangeLog
trunk/core/lib/utils/files.c
trunk/core/lib/utils/synce_socket.c
Modified: trunk/core/ChangeLog
===================================================================
--- trunk/core/ChangeLog 2019-08-20 12:36:18 UTC (rev 4331)
+++ trunk/core/ChangeLog 2019-09-03 18:41:59 UTC (rev 4332)
@@ -1,3 +1,8 @@
+2019-09-03 Arndt Kaiser
+
+ * fix unhandled string-truncations which are detected by new
+ gcc compiler versions
+
2019-08-20 Arndt Kaiser
* use gobject-introspection bindings to access libgudev, because
Modified: trunk/core/lib/utils/files.c
===================================================================
--- trunk/core/lib/utils/files.c 2019-08-20 12:36:18 UTC (rev 4331)
+++ trunk/core/lib/utils/files.c 2019-09-03 18:41:59 UTC (rev 4332)
@@ -63,6 +63,7 @@
char buffer[MAX_PATH];
char *p;
struct passwd* user = NULL;
+ int length;
if (!path)
return false;
@@ -84,7 +85,9 @@
if (!user)
return false;
- snprintf(buffer, sizeof(buffer), "%s/" DIRECTORY_NAME, user->pw_dir);
+ length = snprintf(buffer, sizeof(buffer), "%s/" DIRECTORY_NAME, user->pw_dir);
+ if ((length < 0) || (length >= (int) sizeof(buffer)))
+ return false;
if (!make_sure_directory_exists(buffer))
return false;
@@ -158,6 +161,7 @@
bool success = false;
char* path = NULL;
char buffer[MAX_PATH];
+ int length;
if (!filename)
goto exit;
@@ -167,7 +171,10 @@
if (!synce_get_directory(&path))
goto exit;
- snprintf(buffer, sizeof(buffer), "%s/%s" , path, connection_filename);
+ length = snprintf(buffer, sizeof(buffer), "%s/%s" , path, connection_filename);
+ if ((length < 0) || (length >= (int) sizeof(buffer)))
+ goto exit;
+
*filename = strdup(buffer);
success = true;
@@ -193,6 +200,7 @@
bool success = false;
char* path = NULL;
char buffer[MAX_PATH];
+ int length;
if (!name || !directory)
goto exit;
@@ -205,7 +213,9 @@
if (!synce_get_directory(&path))
goto exit;
- snprintf(buffer, sizeof(buffer), "%s/%s", path, name);
+ length = snprintf(buffer, sizeof(buffer), "%s/%s", path, name);
+ if ((length < 0) || (length >= (int) sizeof(buffer)))
+ goto exit;
if (!make_sure_directory_exists(buffer))
goto exit;
Modified: trunk/core/lib/utils/synce_socket.c
===================================================================
--- trunk/core/lib/utils/synce_socket.c 2019-08-20 12:36:18 UTC (rev 4331)
+++ trunk/core/lib/utils/synce_socket.c 2019-09-03 18:41:59 UTC (rev 4332)
@@ -5,6 +5,7 @@
#include "synce_socket.h"
#include "synce_log.h"
+#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <unistd.h>
@@ -216,37 +217,35 @@
*/
bool synce_socket_connect_proxy(SynceSocket* syncesock, const char* remoteIpAddress)
{
+ struct sockaddr_un proxyaddr;
+ char *path = NULL;
+ int length;
+
synce_socket_close(syncesock);
if (!synce_socket_create_proxy(syncesock))
goto fail;
-
- char *path;
-
if (!synce_get_subdirectory("rapi2", &path)) {
goto fail;
}
- char socketPath[256];
+ length = snprintf(proxyaddr.sun_path, sizeof(proxyaddr.sun_path), "%s/%s", path, remoteIpAddress);
+ if ((length < 0) || (length >= (int) sizeof(proxyaddr.sun_path)))
+ goto fail;
- strncpy(socketPath, path, 256);
- strncat(socketPath, "/", 256 - strlen(socketPath));
- strncat(socketPath, remoteIpAddress, 256 - strlen(socketPath));
-
- free(path);
-
- struct sockaddr_un proxyaddr;
-
proxyaddr.sun_family = AF_LOCAL;
- strncpy(proxyaddr.sun_path, socketPath, sizeof(proxyaddr.sun_path));
-
if (connect(syncesock->fd, (struct sockaddr *) &proxyaddr, sizeof(proxyaddr)) < 0)
goto fail;
+ free(path);
+
return true;
fail:
+ if (path != NULL)
+ free(path);
+
synce_socket_close(syncesock);
return false;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <maj...@us...> - 2019-08-20 12:36:20
|
Revision: 4331
http://sourceforge.net/p/synce/code/4331
Author: majestro
Date: 2019-08-20 12:36:18 +0000 (Tue, 20 Aug 2019)
Log Message:
-----------
use gobject-introspection bindings to access libgudev, because the old python-library for libgudev is deprecated
Modified Paths:
--------------
trunk/core/ChangeLog
trunk/core/scripts/synce-serial.in
Modified: trunk/core/ChangeLog
===================================================================
--- trunk/core/ChangeLog 2018-10-01 10:21:21 UTC (rev 4330)
+++ trunk/core/ChangeLog 2019-08-20 12:36:18 UTC (rev 4331)
@@ -1,3 +1,8 @@
+2019-08-20 Arndt Kaiser
+
+ * use gobject-introspection bindings to access libgudev, because
+ the old python-library for libgudev is deprecated
+
2018-10-01 Arndt Kaiser
* synce-pcp now aborts at the first error if copying a directory
Modified: trunk/core/scripts/synce-serial.in
===================================================================
--- trunk/core/scripts/synce-serial.in 2018-10-01 10:21:21 UTC (rev 4330)
+++ trunk/core/scripts/synce-serial.in 2019-08-20 12:36:18 UTC (rev 4331)
@@ -14,8 +14,11 @@
import platform
import ConfigParser
import dbus
-import gudev
+import gi
+gi.require_version("GUdev", "1.0")
+from gi.repository import GUdev
+
sys.path.insert(0,"@SYNCEDATADIR@")
import synceconnector
from synceconnector import signal_dccm_connect, process_config, get_logger, serial_stop_device, serial_start_device, serial_get_address, serial_get_devnum
@@ -63,7 +66,7 @@
device_file = sys.argv[2]
- udev_client = gudev.Client("")
+ udev_client = GUdev.Client()
device = udev_client.query_by_device_file(device_file)
if device == None:
logger.critical("Failed to find device "+device_file+" in udev")
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <maj...@us...> - 2018-10-01 10:21:23
|
Revision: 4330
http://sourceforge.net/p/synce/code/4330
Author: majestro
Date: 2018-10-01 10:21:21 +0000 (Mon, 01 Oct 2018)
Log Message:
-----------
synce-pcp and synce-pls now abort at the first error while traversing directories
Modified Paths:
--------------
trunk/core/ChangeLog
trunk/core/tools/pcp.c
trunk/core/tools/pls.c
Modified: trunk/core/ChangeLog
===================================================================
--- trunk/core/ChangeLog 2017-03-21 01:54:29 UTC (rev 4329)
+++ trunk/core/ChangeLog 2018-10-01 10:21:21 UTC (rev 4330)
@@ -1,3 +1,10 @@
+2018-10-01 Arndt Kaiser
+
+ * synce-pcp now aborts at the first error if copying a directory
+ with multiple files
+ * synce-pls now aborts at the first error if traversing
+ multiple directories recursively
+
2017-03-21 Arndt Kaiser
* tidy compiler warnings by removing _BSD_SOURCE and _SVID_SOURCE,
Modified: trunk/core/tools/pcp.c
===================================================================
--- trunk/core/tools/pcp.c 2017-03-21 01:54:29 UTC (rev 4329)
+++ trunk/core/tools/pcp.c 2018-10-01 10:21:21 UTC (rev 4330)
@@ -291,6 +291,9 @@
free(new_src);
free(new_dest);
+
+ if (!result)
+ break;
}
IRAPISession_CeRapiFreeBuffer(session, data);
@@ -322,6 +325,9 @@
free(new_src);
free(new_dest);
+
+ if (!result)
+ break;
}
closedir(dir_handle);
Modified: trunk/core/tools/pls.c
===================================================================
--- trunk/core/tools/pls.c 2017-03-21 01:54:29 UTC (rev 4329)
+++ trunk/core/tools/pls.c 2018-10-01 10:21:21 UTC (rev 4330)
@@ -380,8 +380,11 @@
free(base_path);
free(entry_name);
- list_matching_files(session, new_path, FALSE);
+ success = list_matching_files(session, new_path, FALSE);
free(new_path);
+
+ if (!success)
+ goto exit;
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <maj...@us...> - 2017-03-21 01:54:32
|
Revision: 4329
http://sourceforge.net/p/synce/code/4329
Author: majestro
Date: 2017-03-21 01:54:29 +0000 (Tue, 21 Mar 2017)
Log Message:
-----------
get rid of compiler warnings by removing unused variables
Modified Paths:
--------------
trunk/core/ChangeLog
trunk/core/lib/rapi/support/rapi_context.c
Modified: trunk/core/ChangeLog
===================================================================
--- trunk/core/ChangeLog 2017-03-20 23:47:21 UTC (rev 4328)
+++ trunk/core/ChangeLog 2017-03-21 01:54:29 UTC (rev 4329)
@@ -2,6 +2,7 @@
* tidy compiler warnings by removing _BSD_SOURCE and _SVID_SOURCE,
because both are deprecated since glibc 2.20
+ * get rid of compiler warnings by removing unused variables
2017-02-08 Arndt Kaiser
Modified: trunk/core/lib/rapi/support/rapi_context.c
===================================================================
--- trunk/core/lib/rapi/support/rapi_context.c 2017-03-20 23:47:21 UTC (rev 4328)
+++ trunk/core/lib/rapi/support/rapi_context.c 2017-03-21 01:54:29 UTC (rev 4329)
@@ -35,8 +35,6 @@
static const char* const DBUS_PATH = "/org/freedesktop/DBus";
static const char* const DCCM_SERVICE = "org.synce.dccm";
-static const char* const DCCM_MGR_PATH = "/org/synce/dccm/DeviceManager";
-static const char* const DCCM_MGR_IFACE = "org.synce.dccm.DeviceManager";
static const char* const DCCM_DEV_IFACE = "org.synce.dccm.Device";
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <maj...@us...> - 2017-03-20 23:47:24
|
Revision: 4328
http://sourceforge.net/p/synce/code/4328
Author: majestro
Date: 2017-03-20 23:47:21 +0000 (Mon, 20 Mar 2017)
Log Message:
-----------
tidy compiler warnings by removing _BSD_SOURCE and _SVID_SOURCE, because both are deprecated since glibc 2.20
Modified Paths:
--------------
trunk/core/ChangeLog
trunk/core/lib/rapi/connection.c
trunk/core/lib/utils/info.c
trunk/core/lib/utils/synce_log.c
trunk/core/lib/utils/wstr.c
trunk/librra/ChangeLog
trunk/librra/lib/environment.c
trunk/librra/lib/matchmaker.c
trunk/librra/lib/recurrence_pattern.c
trunk/librra/lib/syncmgr.c
trunk/librra/lib/task.c
trunk/librra/lib/timezone.c
trunk/librra/src/rra-delete.c
trunk/librra/src/rra-get-data.c
trunk/librra/src/rra-get-ids.c
trunk/librra/src/rra-get-recurring-appointments.c
trunk/librra/src/rra-get-types.c
trunk/librra/src/rra-partners.c
trunk/librra/src/rra-put-data.c
trunk/librra/src/rra-subscribe.c
trunk/librra/src/rra-timezone.c
trunk/orange/ChangeLog
trunk/orange/lib/extract.c
trunk/orange/lib/helper.c
trunk/orange/lib/inno.c
trunk/orange/lib/installshield_sfx.c
trunk/orange/lib/msi-gsf.c
trunk/orange/lib/msi.c
trunk/orange/lib/rsrc.c
trunk/orange/lib/separate.c
trunk/orange/lib/squeeze.c
trunk/orange/lib/suf.c
trunk/orange/lib/tomtom.c
trunk/orange/lib/vise.c
trunk/orange/src/orange.c
Modified: trunk/core/ChangeLog
===================================================================
--- trunk/core/ChangeLog 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/core/ChangeLog 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,8 +1,15 @@
+2017-03-21 Arndt Kaiser
+
+ * tidy compiler warnings by removing _BSD_SOURCE and _SVID_SOURCE,
+ because both are deprecated since glibc 2.20
+
2017-02-08 Arndt Kaiser
+
* use g_realloc() for iobuf-allocation because it's simpler,
prevents memory leaks and performs better
2017-02-07 Arndt Kaiser
+
* improve error handling of failed async-reads
* returned GErrors should be freed (memory leaks fixed)
* don't start new async-reads while there are pending
@@ -11,7 +18,7 @@
the io-stream must be closed to abort the pending
async-read of the last ping. The aborted read also releases
the last reference to the device-object
- * remove unnessessary call to g_object_get()
+ * remove unnecessary call to g_object_get()
* remove synce_device_dbus_uninit() because dbus-uninit
is already done by synce_device_dispose()
* raise required GIO Version to 2.30 because
@@ -18,10 +25,12 @@
g_dbus_interface_skeleton_export() is used
2017-02-01 Arndt Kaiser
+
* prevent unintentional deletion of the pppd-pidfile in
scripts/synceconnector.py.in
2017-01-06 Arndt Kaiser
+
* prevent devices from being registered multiple times
2017-01-05 Arndt Kaiser
Modified: trunk/core/lib/rapi/connection.c
===================================================================
--- trunk/core/lib/rapi/connection.c 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/core/lib/rapi/connection.c 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,4 +1,3 @@
-#define _BSD_SOURCE 1
#include "rapi.h"
#include "rapi_context.h"
#include "synce_log.h"
Modified: trunk/core/lib/utils/info.c
===================================================================
--- trunk/core/lib/utils/info.c 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/core/lib/utils/info.c 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,5 +1,4 @@
/* $Id$ */
-#define _BSD_SOURCE 1
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
Modified: trunk/core/lib/utils/synce_log.c
===================================================================
--- trunk/core/lib/utils/synce_log.c 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/core/lib/utils/synce_log.c 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,5 +1,4 @@
/* $Id */
-#define _BSD_SOURCE 1
#include "synce_log.h"
#include <stdarg.h>
#include <stdio.h>
Modified: trunk/core/lib/utils/wstr.c
===================================================================
--- trunk/core/lib/utils/wstr.c 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/core/lib/utils/wstr.c 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,5 +1,4 @@
/* $Id$ */
-#define _BSD_SOURCE 1
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
Modified: trunk/librra/ChangeLog
===================================================================
--- trunk/librra/ChangeLog 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/librra/ChangeLog 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,3 +1,8 @@
+2017-03-21 Arndt Kaiser
+
+ * tidy compiler warnings by removing _BSD_SOURCE and _SVID_SOURCE,
+ because both are deprecated since glibc 2.20
+
2013-07-25 Mark Ellis <ma...@mp...>
* 0.17 release
Modified: trunk/librra/lib/environment.c
===================================================================
--- trunk/librra/lib/environment.c 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/librra/lib/environment.c 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,5 +1,4 @@
/* $Id$ */
-#define _BSD_SOURCE
#include "environment.h"
#include <stdlib.h>
#include <string.h>
Modified: trunk/librra/lib/matchmaker.c
===================================================================
--- trunk/librra/lib/matchmaker.c 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/librra/lib/matchmaker.c 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,6 +1,4 @@
/* $Id$ */
-#define _BSD_SOURCE 1
-#define _SVID_SOURCE 1
#include "matchmaker.h"
#include <synce_log.h>
#include <synce_ini.h>
Modified: trunk/librra/lib/recurrence_pattern.c
===================================================================
--- trunk/librra/lib/recurrence_pattern.c 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/librra/lib/recurrence_pattern.c 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,5 +1,4 @@
/* $Id$ */
-#define _BSD_SOURCE 1
#include "recurrence_pattern.h"
#include "environment.h"
#include <stdio.h>
Modified: trunk/librra/lib/syncmgr.c
===================================================================
--- trunk/librra/lib/syncmgr.c 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/librra/lib/syncmgr.c 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,5 +1,4 @@
/* $Id$ */
-#define _BSD_SOURCE 1
#include "syncmgr.h"
#include "rrac.h"
#include "uint32vector.h"
Modified: trunk/librra/lib/task.c
===================================================================
--- trunk/librra/lib/task.c 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/librra/lib/task.c 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,5 +1,4 @@
/* $Id$ */
-#define _BSD_SOURCE 1
#include "task.h"
#include "appointment_ids.h"
#include "timezone.h"
Modified: trunk/librra/lib/timezone.c
===================================================================
--- trunk/librra/lib/timezone.c 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/librra/lib/timezone.c 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,5 +1,4 @@
/* $Id$ */
-#define _BSD_SOURCE 1
#include "timezone.h"
#include "generator.h"
#include <rapi2.h>
Modified: trunk/librra/src/rra-delete.c
===================================================================
--- trunk/librra/src/rra-delete.c 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/librra/src/rra-delete.c 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,5 +1,4 @@
/* $Id$ */
-#define _BSD_SOURCE 1
#include "../lib/syncmgr.h"
#include <rapi2.h>
#include <synce_log.h>
Modified: trunk/librra/src/rra-get-data.c
===================================================================
--- trunk/librra/src/rra-get-data.c 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/librra/src/rra-get-data.c 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,5 +1,4 @@
/* $Id$ */
-#define _BSD_SOURCE 1
#include "syncmgr.h"
#include <rapi2.h>
#include <synce_log.h>
Modified: trunk/librra/src/rra-get-ids.c
===================================================================
--- trunk/librra/src/rra-get-ids.c 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/librra/src/rra-get-ids.c 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,5 +1,4 @@
/* $Id$ */
-#define _BSD_SOURCE 1
#include "../lib/syncmgr.h"
#include <rapi2.h>
#include <synce_log.h>
Modified: trunk/librra/src/rra-get-recurring-appointments.c
===================================================================
--- trunk/librra/src/rra-get-recurring-appointments.c 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/librra/src/rra-get-recurring-appointments.c 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,5 +1,4 @@
/* $Id$ */
-#define _BSD_SOURCE 1
#include "../lib/syncmgr.h"
#include "../lib/uint32vector.h"
#include "../lib/appointment_ids.h"
Modified: trunk/librra/src/rra-get-types.c
===================================================================
--- trunk/librra/src/rra-get-types.c 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/librra/src/rra-get-types.c 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,5 +1,4 @@
/* $Id$ */
-#define _BSD_SOURCE 1
#include "syncmgr.h"
#include <rapi2.h>
#include <synce_log.h>
Modified: trunk/librra/src/rra-partners.c
===================================================================
--- trunk/librra/src/rra-partners.c 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/librra/src/rra-partners.c 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,5 +1,4 @@
/* $Id$ */
-#define _BSD_SOURCE 1
#include <rapi2.h>
#include <synce_log.h>
#include "matchmaker.h"
Modified: trunk/librra/src/rra-put-data.c
===================================================================
--- trunk/librra/src/rra-put-data.c 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/librra/src/rra-put-data.c 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,5 +1,4 @@
/* $Id$ */
-#define _BSD_SOURCE 1
#include "../lib/syncmgr.h"
#include <rapi2.h>
#include <synce_log.h>
Modified: trunk/librra/src/rra-subscribe.c
===================================================================
--- trunk/librra/src/rra-subscribe.c 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/librra/src/rra-subscribe.c 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,5 +1,4 @@
/* $Id$ */
-#define _BSD_SOURCE 1
#include "../lib/syncmgr.h"
#include <rapi2.h>
#include <synce_log.h>
Modified: trunk/librra/src/rra-timezone.c
===================================================================
--- trunk/librra/src/rra-timezone.c 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/librra/src/rra-timezone.c 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,6 +1,4 @@
/* $Id$ */
-#define _POSIX_C_SOURCE 2 /* for getopt */
-#define _BSD_SOURCE
#include "../lib/timezone.h"
#include "../lib/generator.h"
#include <rapi2.h>
Modified: trunk/orange/ChangeLog
===================================================================
--- trunk/orange/ChangeLog 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/orange/ChangeLog 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,3 +1,8 @@
+2017-03-21 Arndt Kaiser
+
+ * tidy compiler warnings by removing _BSD_SOURCE and _SVID_SOURCE,
+ because both are deprecated since glibc 2.20
+
2009-01-10 Mark Ellis <ma...@mp...>
* 0.4 release
Modified: trunk/orange/lib/extract.c
===================================================================
--- trunk/orange/lib/extract.c 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/orange/lib/extract.c 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,5 +1,4 @@
/* $Id$ */
-#define _BSD_SOURCE 1
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
Modified: trunk/orange/lib/helper.c
===================================================================
--- trunk/orange/lib/helper.c 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/orange/lib/helper.c 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,5 +1,4 @@
/* $Id$ */
-#define _BSD_SOURCE 1
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
Modified: trunk/orange/lib/inno.c
===================================================================
--- trunk/orange/lib/inno.c 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/orange/lib/inno.c 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,5 +1,4 @@
/* $Id$ */
-#define _BSD_SOURCE 1
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
Modified: trunk/orange/lib/installshield_sfx.c
===================================================================
--- trunk/orange/lib/installshield_sfx.c 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/orange/lib/installshield_sfx.c 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,4 +1,3 @@
-#define _BSD_SOURCE 1
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
Modified: trunk/orange/lib/msi-gsf.c
===================================================================
--- trunk/orange/lib/msi-gsf.c 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/orange/lib/msi-gsf.c 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,4 +1,3 @@
-#define _BSD_SOURCE 1
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
Modified: trunk/orange/lib/msi.c
===================================================================
--- trunk/orange/lib/msi.c 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/orange/lib/msi.c 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,4 +1,3 @@
-#define _BSD_SOURCE 1
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
Modified: trunk/orange/lib/rsrc.c
===================================================================
--- trunk/orange/lib/rsrc.c 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/orange/lib/rsrc.c 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,7 +1,6 @@
/*
* Extract data from .rsrc section of PE file
*/
-#define _BSD_SOURCE 1
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
Modified: trunk/orange/lib/separate.c
===================================================================
--- trunk/orange/lib/separate.c 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/orange/lib/separate.c 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,5 +1,4 @@
/* $Id$ */
-#define _BSD_SOURCE 1
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
Modified: trunk/orange/lib/squeeze.c
===================================================================
--- trunk/orange/lib/squeeze.c 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/orange/lib/squeeze.c 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,5 +1,4 @@
/* $Id$ */
-#define _BSD_SOURCE 1
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
Modified: trunk/orange/lib/suf.c
===================================================================
--- trunk/orange/lib/suf.c 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/orange/lib/suf.c 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,5 +1,4 @@
/* $Id$ */
-#define _BSD_SOURCE 1
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
Modified: trunk/orange/lib/tomtom.c
===================================================================
--- trunk/orange/lib/tomtom.c 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/orange/lib/tomtom.c 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,5 +1,4 @@
/* $Id$ */
-#define _BSD_SOURCE 1
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
Modified: trunk/orange/lib/vise.c
===================================================================
--- trunk/orange/lib/vise.c 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/orange/lib/vise.c 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,5 +1,4 @@
/* $Id$ */
-#define _BSD_SOURCE 1
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
Modified: trunk/orange/src/orange.c
===================================================================
--- trunk/orange/src/orange.c 2017-02-09 01:13:08 UTC (rev 4327)
+++ trunk/orange/src/orange.c 2017-03-20 23:47:21 UTC (rev 4328)
@@ -1,6 +1,4 @@
/* $Id$ */
-#define _BSD_SOURCE 1
-#define _POSIX_C_SOURCE 2
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <maj...@us...> - 2017-02-08 00:21:21
|
Revision: 4325
http://sourceforge.net/p/synce/code/4325
Author: majestro
Date: 2017-02-08 00:21:18 +0000 (Wed, 08 Feb 2017)
Log Message:
-----------
use g_realloc() for iobuf-allocation because it's simpler, prevents memory leaks and performs better
Modified Paths:
--------------
trunk/core/ChangeLog
trunk/core/dccm/synce-device-legacy.c
trunk/core/dccm/synce-device-rndis.c
trunk/core/dccm/synce-device.c
Modified: trunk/core/ChangeLog
===================================================================
--- trunk/core/ChangeLog 2017-02-07 16:09:53 UTC (rev 4324)
+++ trunk/core/ChangeLog 2017-02-08 00:21:18 UTC (rev 4325)
@@ -1,3 +1,7 @@
+2017-02-08 Arndt Kaiser
+ * use g_realloc() for iobuf-allocation because it's simpler,
+ prevents memory leaks and performs better
+
2017-02-07 Arndt Kaiser
* improve error handling of failed async-reads
* returned GErrors should be freed (memory leaks fixed)
Modified: trunk/core/dccm/synce-device-legacy.c
===================================================================
--- trunk/core/dccm/synce-device-legacy.c 2017-02-07 16:09:53 UTC (rev 4324)
+++ trunk/core/dccm/synce-device-legacy.c 2017-02-08 00:21:18 UTC (rev 4325)
@@ -68,8 +68,8 @@
/* do a read here ? */
GInputStream *istream = g_io_stream_get_input_stream(G_IO_STREAM(priv->conn));
if (!g_input_stream_has_pending(istream)) {
- priv->iobuf = g_malloc(4);
- g_input_stream_read_async(istream, priv->iobuf, 4, G_PRIORITY_DEFAULT, NULL, synce_device_conn_event_cb, g_object_ref(self));
+ priv->iobuf = g_realloc(priv->iobuf, 4);
+ g_input_stream_read_async(istream, priv->iobuf, 4, G_PRIORITY_DEFAULT, NULL, synce_device_conn_event_cb, g_object_ref(self));
}
if (++priv_legacy->ping_count == DCCM_MAX_PING_COUNT) {
@@ -230,7 +230,6 @@
if (error != NULL) {
g_debug("%s: failed to read data: %s", G_STRFUNC, error->message);
g_error_free(error);
- g_free(priv->iobuf);
g_object_unref(self);
return;
}
@@ -243,17 +242,15 @@
if (num_read != 4)
{
g_warning ("%s: unexpected length", G_STRFUNC);
- g_free(priv->iobuf);
g_object_unref(self);
return;
}
header = GUINT32_FROM_LE (*((guint32 *) priv->iobuf));
- g_free(priv->iobuf);
if (header == 0) {
/* empty packet header */
- priv->iobuf = g_malloc(4);
+ priv->iobuf = g_realloc(priv->iobuf, 4);
g_input_stream_read_async(istream, priv->iobuf, 4, G_PRIORITY_DEFAULT, NULL, synce_device_conn_event_cb, g_object_ref(self));
g_object_unref(self);
return;
@@ -266,7 +263,7 @@
/* info message */
priv->state = CTRL_STATE_GETTING_INFO;
priv->info_buf_size = header;
- priv->iobuf = g_malloc(priv->info_buf_size);
+ priv->iobuf = g_realloc(priv->iobuf, priv->info_buf_size);
g_input_stream_read_async(istream, priv->iobuf, priv->info_buf_size, G_PRIORITY_DEFAULT, NULL, synce_device_conn_event_cb, g_object_ref(self));
} else {
/* password challenge */
@@ -274,7 +271,7 @@
/*
synce_device_change_password_flags (SYNCE_DEVICE(self), SYNCE_DEVICE_PASSWORD_FLAG_PROVIDE);
*/
- priv->iobuf = g_malloc(4);
+ priv->iobuf = g_realloc(priv->iobuf, 4);
g_input_stream_read_async(istream, priv->iobuf, 4, G_PRIORITY_DEFAULT, NULL, synce_device_conn_event_cb, g_object_ref(self));
}
}
@@ -291,9 +288,7 @@
gchar *info_buf = g_malloc(num_read);
memcpy(info_buf, priv->iobuf, num_read);
- g_free(priv->iobuf);
- synce_device_legacy_info_received(self, (guchar *) info_buf,
- num_read);
+ synce_device_legacy_info_received(self, (guchar *) info_buf, num_read);
g_free(info_buf);
}
else if (priv->state == CTRL_STATE_AUTH)
@@ -309,7 +304,6 @@
}
result = GUINT16_FROM_LE (*((guint16 *) priv->iobuf));
- g_free(priv->iobuf);
if (result != 0)
{
@@ -339,11 +333,10 @@
return;
}
req = GUINT32_FROM_LE (*((guint32 *) priv->iobuf));
- g_free(priv->iobuf);
if (req == 0) {
/* empty packet header */
- priv->iobuf = g_malloc(4);
+ priv->iobuf = g_realloc(priv->iobuf, 4);
g_input_stream_read_async(istream, priv->iobuf, 4, G_PRIORITY_DEFAULT, NULL, synce_device_conn_event_cb, g_object_ref(self));
g_object_unref(self);
return;
Modified: trunk/core/dccm/synce-device-rndis.c
===================================================================
--- trunk/core/dccm/synce-device-rndis.c 2017-02-07 16:09:53 UTC (rev 4324)
+++ trunk/core/dccm/synce-device-rndis.c 2017-02-08 00:21:18 UTC (rev 4325)
@@ -223,7 +223,7 @@
}
GInputStream *in_stream = g_io_stream_get_input_stream(G_IO_STREAM(priv->conn));
- priv->iobuf = g_malloc(sizeof(guint32));
+ priv->iobuf = g_realloc(priv->iobuf, sizeof(guint32));
g_input_stream_read_async(in_stream, priv->iobuf, sizeof(guint32), G_PRIORITY_DEFAULT, NULL, synce_device_conn_event_cb, g_object_ref(self));
/*
@@ -266,7 +266,6 @@
if (error != NULL) {
g_debug("%s: failed to read data: %s", G_STRFUNC, error->message);
g_error_free(error);
- g_free(priv->iobuf);
g_object_unref(self);
return;
}
@@ -282,13 +281,11 @@
if (num_read != 4)
{
g_warning ("%s: unexpected length", G_STRFUNC);
- g_free(priv->iobuf);
g_object_unref(self);
return;
}
req = GUINT32_FROM_LE (*((guint32 *) priv->iobuf));
- g_free(priv->iobuf);
resp = g_array_sized_new (FALSE, FALSE, sizeof (guint32), 1);
switch (req)
@@ -298,7 +295,7 @@
break;
case 4:
priv->state = CTRL_STATE_GETTING_INFO;
- priv->iobuf = g_malloc(4);
+ priv->iobuf = g_realloc(priv->iobuf, 4);
g_input_stream_read_async(istream, priv->iobuf, 4, G_PRIORITY_DEFAULT, NULL, synce_device_conn_event_cb, g_object_ref(self));
break;
case 6:
@@ -329,7 +326,7 @@
g_critical("%s: failed to write control message to device: %s", G_STRFUNC, error->message);
g_error_free(error);
}
- priv->iobuf = g_malloc(4);
+ priv->iobuf = g_realloc(priv->iobuf, 4);
g_input_stream_read_async(istream, priv->iobuf, 4, G_PRIORITY_DEFAULT, NULL, synce_device_conn_event_cb, g_object_ref(self));
g_free (buf);
@@ -344,15 +341,12 @@
if (num_read != 4)
{
g_warning ("%s: event->length != 4", G_STRFUNC);
- g_free(priv->iobuf);
g_object_unref(self);
return;
}
priv->info_buf_size = GUINT32_FROM_LE (*((guint32 *) priv->iobuf));
- g_free(priv->iobuf);
-
- priv->iobuf = g_malloc(priv->info_buf_size);
+ priv->iobuf = g_realloc(priv->iobuf, priv->info_buf_size);
g_input_stream_read_async(istream, priv->iobuf, priv->info_buf_size, G_PRIORITY_DEFAULT, NULL, synce_device_conn_event_cb, g_object_ref(self));
}
else
@@ -361,16 +355,13 @@
{
g_warning ("%s: length read=%zd != info_buf_size=%d",
G_STRFUNC, num_read, priv->info_buf_size);
- g_free(priv->iobuf);
g_object_unref(self);
return;
}
gchar *info_buf = g_malloc0(num_read);
memcpy(info_buf, priv->iobuf, num_read);
- g_free(priv->iobuf);
- synce_device_rndis_info_received(self, (guchar *) info_buf,
- num_read);
+ synce_device_rndis_info_received(self, (guchar *) info_buf, num_read);
g_free(info_buf);
}
}
@@ -384,13 +375,11 @@
if (num_read != sizeof (guint16))
{
g_warning ("%s: length read != 2", G_STRFUNC);
- g_free(priv->iobuf);
g_object_unref(self);
return;
}
result = GUINT16_FROM_LE (*((guint16 *) priv->iobuf));
- g_free(priv->iobuf);
if (result != 0)
{
@@ -409,7 +398,6 @@
guint32 result;
result = GUINT32_FROM_LE (*((guint32 *) priv->iobuf));
- g_free(priv->iobuf);
if (result == 0)
{
priv->state = CTRL_STATE_CONNECTED;
Modified: trunk/core/dccm/synce-device.c
===================================================================
--- trunk/core/dccm/synce-device.c 2017-02-07 16:09:53 UTC (rev 4324)
+++ trunk/core/dccm/synce-device.c 2017-02-08 00:21:18 UTC (rev 4325)
@@ -117,7 +117,7 @@
}
GInputStream *in_stream = g_io_stream_get_input_stream(G_IO_STREAM(priv->conn));
- priv->iobuf = g_malloc(sizeof (guint16));
+ priv->iobuf = g_realloc(priv->iobuf, sizeof (guint16));
g_input_stream_read_async(in_stream, priv->iobuf, sizeof (guint16), G_PRIORITY_DEFAULT, NULL, synce_device_conn_event_cb, g_object_ref(self));
synce_device_change_password_flags (self, SYNCE_DEVICE_PASSWORD_FLAG_CHECKING);
@@ -571,6 +571,7 @@
SynceDevice *self = SYNCE_DEVICE (obj);
SynceDevicePrivate *priv = SYNCE_DEVICE_GET_PRIVATE (self);
+ g_free (priv->iobuf);
g_free (priv->device_path);
g_free (priv->guid);
@@ -667,7 +668,7 @@
g_object_ref (priv->conn);
GInputStream *in_stream = g_io_stream_get_input_stream(G_IO_STREAM(priv->conn));
- priv->iobuf = g_malloc(sizeof (guint32));
+ priv->iobuf = g_realloc(priv->iobuf, sizeof (guint32));
g_input_stream_read_async(in_stream, priv->iobuf, sizeof (guint32), G_PRIORITY_DEFAULT, NULL, synce_device_conn_event_cb, g_object_ref(self));
GInetSocketAddress *address = NULL;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <maj...@us...> - 2017-02-07 16:09:55
|
Revision: 4324
http://sourceforge.net/p/synce/code/4324
Author: majestro
Date: 2017-02-07 16:09:53 +0000 (Tue, 07 Feb 2017)
Log Message:
-----------
raise required GIO Version to 2.30 because g_dbus_interface_skeleton_export() is used
Modified Paths:
--------------
trunk/core/ChangeLog
trunk/core/configure.ac.in
Modified: trunk/core/ChangeLog
===================================================================
--- trunk/core/ChangeLog 2017-02-07 14:52:05 UTC (rev 4323)
+++ trunk/core/ChangeLog 2017-02-07 16:09:53 UTC (rev 4324)
@@ -10,6 +10,8 @@
* remove unnessessary call to g_object_get()
* remove synce_device_dbus_uninit() because dbus-uninit
is already done by synce_device_dispose()
+ * raise required GIO Version to 2.30 because
+ g_dbus_interface_skeleton_export() is used
2017-02-01 Arndt Kaiser
* prevent unintentional deletion of the pppd-pidfile in
Modified: trunk/core/configure.ac.in
===================================================================
--- trunk/core/configure.ac.in 2017-02-07 14:52:05 UTC (rev 4323)
+++ trunk/core/configure.ac.in 2017-02-07 16:09:53 UTC (rev 4324)
@@ -71,7 +71,7 @@
AC_LIB_RPATH
dnl Check for GLib
-PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.7, gobject-2.0 >= 2.4, gio-2.0 >= 2.26, gio-unix-2.0 >= 2.22])
+PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.7, gobject-2.0 >= 2.4, gio-2.0 >= 2.30, gio-unix-2.0 >= 2.22])
dnl Check for D-Bus, we need dbus-1 for config file locations
PKG_CHECK_MODULES(DBUS, [dbus-1 >= 0.60])
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <maj...@us...> - 2017-02-07 14:52:07
|
Revision: 4323
http://sourceforge.net/p/synce/code/4323
Author: majestro
Date: 2017-02-07 14:52:05 +0000 (Tue, 07 Feb 2017)
Log Message:
-----------
remove synce_device_dbus_uninit() because dbus-uninit is already done by synce_device_dispose()
Modified Paths:
--------------
trunk/core/ChangeLog
trunk/core/dccm/synce-device-internal.h
trunk/core/dccm/synce-device-legacy.c
trunk/core/dccm/synce-device.c
Modified: trunk/core/ChangeLog
===================================================================
--- trunk/core/ChangeLog 2017-02-07 14:32:43 UTC (rev 4322)
+++ trunk/core/ChangeLog 2017-02-07 14:52:05 UTC (rev 4323)
@@ -8,6 +8,8 @@
async-read of the last ping. The aborted read also releases
the last reference to the device-object
* remove unnessessary call to g_object_get()
+ * remove synce_device_dbus_uninit() because dbus-uninit
+ is already done by synce_device_dispose()
2017-02-01 Arndt Kaiser
* prevent unintentional deletion of the pppd-pidfile in
Modified: trunk/core/dccm/synce-device-internal.h
===================================================================
--- trunk/core/dccm/synce-device-internal.h 2017-02-07 14:32:43 UTC (rev 4322)
+++ trunk/core/dccm/synce-device-internal.h 2017-02-07 14:52:05 UTC (rev 4323)
@@ -75,7 +75,6 @@
void synce_device_change_password_flags (SynceDevice *self, SynceDevicePasswordFlags new_flag);
void synce_device_conn_broker_done_cb (SynceConnectionBroker *broker, gpointer user_data);
void synce_device_dbus_init(SynceDevice *self);
-void synce_device_dbus_uninit(SynceDevice *self);
void synce_device_conn_event_cb(GObject *istream, GAsyncResult *res, gpointer user_data);
G_END_DECLS
Modified: trunk/core/dccm/synce-device-legacy.c
===================================================================
--- trunk/core/dccm/synce-device-legacy.c 2017-02-07 14:32:43 UTC (rev 4322)
+++ trunk/core/dccm/synce-device-legacy.c 2017-02-07 14:52:05 UTC (rev 4323)
@@ -74,7 +74,6 @@
if (++priv_legacy->ping_count == DCCM_MAX_PING_COUNT) {
g_warning("%s: Device %s not responded to %d pings, assume disconnected", G_STRFUNC, priv->name, DCCM_MAX_PING_COUNT);
- synce_device_dbus_uninit(SYNCE_DEVICE(self));
g_io_stream_close(G_IO_STREAM(priv->conn), NULL, NULL);
g_signal_emit (self, SYNCE_DEVICE_GET_CLASS(SYNCE_DEVICE(self))->signals[SYNCE_DEVICE_SIGNAL_DISCONNECTED], 0);
return FALSE;
Modified: trunk/core/dccm/synce-device.c
===================================================================
--- trunk/core/dccm/synce-device.c 2017-02-07 14:32:43 UTC (rev 4322)
+++ trunk/core/dccm/synce-device.c 2017-02-07 14:52:05 UTC (rev 4323)
@@ -462,21 +462,6 @@
}
void
-synce_device_dbus_uninit(SynceDevice *self)
-{
- SynceDevicePrivate *priv = SYNCE_DEVICE_GET_PRIVATE (self);
- g_return_if_fail(!(priv->dispose_has_run));
-
- g_message ("%s: unregistering object path '%s'", G_STRFUNC, priv->obj_path);
-
- g_dbus_interface_skeleton_unexport(G_DBUS_INTERFACE_SKELETON(priv->interface));
- g_object_unref(priv->interface);
- priv->interface = NULL;
-
- return;
-}
-
-void
synce_device_change_password_flags (SynceDevice *self,
SynceDevicePasswordFlags new_flag)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <maj...@us...> - 2017-02-07 14:32:45
|
Revision: 4322
http://sourceforge.net/p/synce/code/4322
Author: majestro
Date: 2017-02-07 14:32:43 +0000 (Tue, 07 Feb 2017)
Log Message:
-----------
remove unnessessary call to g_object_get()
Modified Paths:
--------------
trunk/core/ChangeLog
trunk/core/dccm/synce-device-legacy.c
Modified: trunk/core/ChangeLog
===================================================================
--- trunk/core/ChangeLog 2017-02-07 03:45:30 UTC (rev 4321)
+++ trunk/core/ChangeLog 2017-02-07 14:32:43 UTC (rev 4322)
@@ -7,6 +7,7 @@
the io-stream must be closed to abort the pending
async-read of the last ping. The aborted read also releases
the last reference to the device-object
+ * remove unnessessary call to g_object_get()
2017-02-01 Arndt Kaiser
* prevent unintentional deletion of the pppd-pidfile in
Modified: trunk/core/dccm/synce-device-legacy.c
===================================================================
--- trunk/core/dccm/synce-device-legacy.c 2017-02-07 03:45:30 UTC (rev 4321)
+++ trunk/core/dccm/synce-device-legacy.c 2017-02-07 14:32:43 UTC (rev 4322)
@@ -73,15 +73,10 @@
}
if (++priv_legacy->ping_count == DCCM_MAX_PING_COUNT) {
- gchar *name = NULL;
-
- g_object_get(self, "name", &name, NULL);
-
- g_warning("%s: Device %s not responded to %d pings, assume disconnected", G_STRFUNC, name, DCCM_MAX_PING_COUNT);
+ g_warning("%s: Device %s not responded to %d pings, assume disconnected", G_STRFUNC, priv->name, DCCM_MAX_PING_COUNT);
synce_device_dbus_uninit(SYNCE_DEVICE(self));
g_io_stream_close(G_IO_STREAM(priv->conn), NULL, NULL);
g_signal_emit (self, SYNCE_DEVICE_GET_CLASS(SYNCE_DEVICE(self))->signals[SYNCE_DEVICE_SIGNAL_DISCONNECTED], 0);
- g_free(name);
return FALSE;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <maj...@us...> - 2017-02-07 03:45:32
|
Revision: 4321
http://sourceforge.net/p/synce/code/4321
Author: majestro
Date: 2017-02-07 03:45:30 +0000 (Tue, 07 Feb 2017)
Log Message:
-----------
if a device is disconnected because it doesn't respond to pings, the io-stream must be closed to abort the pending async-read of the last ping. The aborted read also releases the last reference to the device-object
Modified Paths:
--------------
trunk/core/ChangeLog
trunk/core/dccm/synce-device-legacy.c
Modified: trunk/core/ChangeLog
===================================================================
--- trunk/core/ChangeLog 2017-02-07 02:46:58 UTC (rev 4320)
+++ trunk/core/ChangeLog 2017-02-07 03:45:30 UTC (rev 4321)
@@ -3,6 +3,10 @@
* returned GErrors should be freed (memory leaks fixed)
* don't start new async-reads while there are pending
async-reads during pinging the device
+ * if a device is disconnected because it doesn't respond to pings,
+ the io-stream must be closed to abort the pending
+ async-read of the last ping. The aborted read also releases
+ the last reference to the device-object
2017-02-01 Arndt Kaiser
* prevent unintentional deletion of the pppd-pidfile in
Modified: trunk/core/dccm/synce-device-legacy.c
===================================================================
--- trunk/core/dccm/synce-device-legacy.c 2017-02-07 02:46:58 UTC (rev 4320)
+++ trunk/core/dccm/synce-device-legacy.c 2017-02-07 03:45:30 UTC (rev 4321)
@@ -79,6 +79,7 @@
g_warning("%s: Device %s not responded to %d pings, assume disconnected", G_STRFUNC, name, DCCM_MAX_PING_COUNT);
synce_device_dbus_uninit(SYNCE_DEVICE(self));
+ g_io_stream_close(G_IO_STREAM(priv->conn), NULL, NULL);
g_signal_emit (self, SYNCE_DEVICE_GET_CLASS(SYNCE_DEVICE(self))->signals[SYNCE_DEVICE_SIGNAL_DISCONNECTED], 0);
g_free(name);
return FALSE;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <maj...@us...> - 2017-02-07 02:47:01
|
Revision: 4320
http://sourceforge.net/p/synce/code/4320
Author: majestro
Date: 2017-02-07 02:46:58 +0000 (Tue, 07 Feb 2017)
Log Message:
-----------
don't start new async-reads while there are pending async-reads during pinging the device
Modified Paths:
--------------
trunk/core/ChangeLog
trunk/core/dccm/synce-device-legacy.c
Modified: trunk/core/ChangeLog
===================================================================
--- trunk/core/ChangeLog 2017-02-07 02:35:25 UTC (rev 4319)
+++ trunk/core/ChangeLog 2017-02-07 02:46:58 UTC (rev 4320)
@@ -1,6 +1,8 @@
2017-02-07 Arndt Kaiser
* improve error handling of failed async-reads
* returned GErrors should be freed (memory leaks fixed)
+ * don't start new async-reads while there are pending
+ async-reads during pinging the device
2017-02-01 Arndt Kaiser
* prevent unintentional deletion of the pppd-pidfile in
Modified: trunk/core/dccm/synce-device-legacy.c
===================================================================
--- trunk/core/dccm/synce-device-legacy.c 2017-02-07 02:35:25 UTC (rev 4319)
+++ trunk/core/dccm/synce-device-legacy.c 2017-02-07 02:46:58 UTC (rev 4320)
@@ -66,9 +66,11 @@
}
/* do a read here ? */
- priv->iobuf = g_malloc(4);
GInputStream *istream = g_io_stream_get_input_stream(G_IO_STREAM(priv->conn));
- g_input_stream_read_async(istream, priv->iobuf, 4, G_PRIORITY_DEFAULT, NULL, synce_device_conn_event_cb, g_object_ref(self));
+ if (!g_input_stream_has_pending(istream)) {
+ priv->iobuf = g_malloc(4);
+ g_input_stream_read_async(istream, priv->iobuf, 4, G_PRIORITY_DEFAULT, NULL, synce_device_conn_event_cb, g_object_ref(self));
+ }
if (++priv_legacy->ping_count == DCCM_MAX_PING_COUNT) {
gchar *name = NULL;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <maj...@us...> - 2017-02-07 02:35:28
|
Revision: 4319
http://sourceforge.net/p/synce/code/4319
Author: majestro
Date: 2017-02-07 02:35:25 +0000 (Tue, 07 Feb 2017)
Log Message:
-----------
returned GErrors should be freed (memory leaks fixed)
Modified Paths:
--------------
trunk/core/ChangeLog
trunk/core/dccm/synce-device-legacy.c
trunk/core/dccm/synce-device-manager.c
trunk/core/dccm/synce-device-rndis.c
Modified: trunk/core/ChangeLog
===================================================================
--- trunk/core/ChangeLog 2017-02-07 01:52:14 UTC (rev 4318)
+++ trunk/core/ChangeLog 2017-02-07 02:35:25 UTC (rev 4319)
@@ -1,5 +1,6 @@
2017-02-07 Arndt Kaiser
* improve error handling of failed async-reads
+ * returned GErrors should be freed (memory leaks fixed)
2017-02-01 Arndt Kaiser
* prevent unintentional deletion of the pppd-pidfile in
Modified: trunk/core/dccm/synce-device-legacy.c
===================================================================
--- trunk/core/dccm/synce-device-legacy.c 2017-02-07 01:52:14 UTC (rev 4318)
+++ trunk/core/dccm/synce-device-legacy.c 2017-02-07 02:35:25 UTC (rev 4319)
@@ -410,7 +410,7 @@
g_free(info->buf);
g_free(info);
- if (num_read == -1) {
+ if (error != NULL) {
g_warning("%s: Failed to get password reply from device: %s", G_STRFUNC, error->message);
g_error_free(error);
g_object_unref(conn);
Modified: trunk/core/dccm/synce-device-manager.c
===================================================================
--- trunk/core/dccm/synce-device-manager.c 2017-02-07 01:52:14 UTC (rev 4318)
+++ trunk/core/dccm/synce-device-manager.c 2017-02-07 02:35:25 UTC (rev 4319)
@@ -334,6 +334,7 @@
if (sock) g_object_unref(sock);
if (inet_address) g_object_unref(inet_address);
if (sock_address) g_object_unref(sock_address);
+ if (error) g_error_free(error);
return;
}
Modified: trunk/core/dccm/synce-device-rndis.c
===================================================================
--- trunk/core/dccm/synce-device-rndis.c 2017-02-07 01:52:14 UTC (rev 4318)
+++ trunk/core/dccm/synce-device-rndis.c 2017-02-07 02:35:25 UTC (rev 4319)
@@ -532,7 +532,7 @@
GError *error = NULL;
gssize num_read = g_input_stream_read_finish(istream, res, &error);
- if (num_read == -1) {
+ if (error != NULL) {
g_warning("%s: failed to read connection ID from device: %s", G_STRFUNC, error->message);
g_error_free(error);
g_object_unref(self);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <maj...@us...> - 2017-02-07 01:52:16
|
Revision: 4318
http://sourceforge.net/p/synce/code/4318
Author: majestro
Date: 2017-02-07 01:52:14 +0000 (Tue, 07 Feb 2017)
Log Message:
-----------
improve error handling of failed async-reads
Modified Paths:
--------------
trunk/core/ChangeLog
trunk/core/dccm/synce-device-legacy.c
trunk/core/dccm/synce-device-rndis.c
Modified: trunk/core/ChangeLog
===================================================================
--- trunk/core/ChangeLog 2017-02-01 00:38:25 UTC (rev 4317)
+++ trunk/core/ChangeLog 2017-02-07 01:52:14 UTC (rev 4318)
@@ -1,3 +1,6 @@
+2017-02-07 Arndt Kaiser
+ * improve error handling of failed async-reads
+
2017-02-01 Arndt Kaiser
* prevent unintentional deletion of the pppd-pidfile in
scripts/synceconnector.py.in
Modified: trunk/core/dccm/synce-device-legacy.c
===================================================================
--- trunk/core/dccm/synce-device-legacy.c 2017-02-01 00:38:25 UTC (rev 4317)
+++ trunk/core/dccm/synce-device-legacy.c 2017-02-07 01:52:14 UTC (rev 4318)
@@ -230,6 +230,13 @@
GError *error = NULL;
gssize num_read = g_input_stream_read_finish(istream, res, &error);
+ if (error != NULL) {
+ g_debug("%s: failed to read data: %s", G_STRFUNC, error->message);
+ g_error_free(error);
+ g_free(priv->iobuf);
+ g_object_unref(self);
+ return;
+ }
if (priv->state < CTRL_STATE_GETTING_INFO)
{
Modified: trunk/core/dccm/synce-device-rndis.c
===================================================================
--- trunk/core/dccm/synce-device-rndis.c 2017-02-01 00:38:25 UTC (rev 4317)
+++ trunk/core/dccm/synce-device-rndis.c 2017-02-07 01:52:14 UTC (rev 4318)
@@ -263,6 +263,13 @@
GError *error = NULL;
gssize num_read = g_input_stream_read_finish(istream, res, &error);
+ if (error != NULL) {
+ g_debug("%s: failed to read data: %s", G_STRFUNC, error->message);
+ g_error_free(error);
+ g_free(priv->iobuf);
+ g_object_unref(self);
+ return;
+ }
if (priv->state == CTRL_STATE_HANDSHAKE)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <maj...@us...> - 2017-02-01 00:38:26
|
Revision: 4317
http://sourceforge.net/p/synce/code/4317
Author: majestro
Date: 2017-02-01 00:38:25 +0000 (Wed, 01 Feb 2017)
Log Message:
-----------
prevent unintentional deletion of the pppd-pidfile in scripts/synceconnector.py.in
Modified Paths:
--------------
trunk/core/ChangeLog
trunk/core/scripts/synceconnector.py.in
Modified: trunk/core/ChangeLog
===================================================================
--- trunk/core/ChangeLog 2017-01-06 09:29:07 UTC (rev 4316)
+++ trunk/core/ChangeLog 2017-02-01 00:38:25 UTC (rev 4317)
@@ -1,5 +1,9 @@
+2017-02-01 Arndt Kaiser
+ * prevent unintentional deletion of the pppd-pidfile in
+ scripts/synceconnector.py.in
+
2017-01-06 Arndt Kaiser
- * prevent devices from beeing registered multiple times
+ * prevent devices from being registered multiple times
2017-01-05 Arndt Kaiser
Modified: trunk/core/scripts/synceconnector.py.in
===================================================================
--- trunk/core/scripts/synceconnector.py.in 2017-01-06 09:29:07 UTC (rev 4316)
+++ trunk/core/scripts/synceconnector.py.in 2017-02-01 00:38:25 UTC (rev 4317)
@@ -248,6 +248,12 @@
#
def serial_start_device(device_file, local_ip, remote_ip, linkname):
+ pidfile = VAR_PPP+"/ppp-"+linkname+".pid"
+
+ if os.path.isfile(pidfile) != False:
+ logger.warning("SynCE connection for %s is still running", linkname)
+ return False
+
ipaddr = local_ip+":"+remote_ip
cmd_list = [PPPD, device_file, DEVSPEED, "connect", "@LIBEXECDIR@/synce-serial-chat", ipaddr, "ms-dns", local_ip]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <maj...@us...> - 2017-01-06 09:29:10
|
Revision: 4316
http://sourceforge.net/p/synce/code/4316
Author: majestro
Date: 2017-01-06 09:29:07 +0000 (Fri, 06 Jan 2017)
Log Message:
-----------
prevent devices from beeing registered multiple times
Modified Paths:
--------------
trunk/core/ChangeLog
trunk/core/dccm/synce-device-manager.c
Modified: trunk/core/ChangeLog
===================================================================
--- trunk/core/ChangeLog 2017-01-05 17:09:59 UTC (rev 4315)
+++ trunk/core/ChangeLog 2017-01-06 09:29:07 UTC (rev 4316)
@@ -1,3 +1,6 @@
+2017-01-06 Arndt Kaiser
+ * prevent devices from beeing registered multiple times
+
2017-01-05 Arndt Kaiser
* fixed infinite loop in synce-serial-chat,
Modified: trunk/core/dccm/synce-device-manager.c
===================================================================
--- trunk/core/dccm/synce-device-manager.c 2017-01-05 17:09:59 UTC (rev 4315)
+++ trunk/core/dccm/synce-device-manager.c 2017-01-06 09:29:07 UTC (rev 4316)
@@ -477,6 +477,21 @@
g_debug("%s: receieved device connected signal for %s", G_STRFUNC, device_path);
+ GSList *device_entry_iter = priv->devices;
+ while (device_entry_iter != NULL) {
+
+ if (strcmp(device_path, ((DeviceEntry*)device_entry_iter->data)->device_path) == 0) {
+ break;
+ }
+
+ device_entry_iter = g_slist_next(device_entry_iter);
+ }
+
+ if (device_entry_iter) {
+ g_debug("%s: ignoring connect signal for already known device %s", G_STRFUNC, device_path);
+ return;
+ }
+
DeviceEntry *deventry = g_new0(DeviceEntry, 1);
if (!deventry) {
g_critical("%s: failed to allocate DeviceEntry", G_STRFUNC);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <maj...@us...> - 2017-01-05 17:10:01
|
Revision: 4315
http://sourceforge.net/p/synce/code/4315
Author: majestro
Date: 2017-01-05 17:09:59 +0000 (Thu, 05 Jan 2017)
Log Message:
-----------
log path of the unix domain socket file, if it can't be created
Modified Paths:
--------------
trunk/core/ChangeLog
trunk/core/dccm/synce-connection-broker.c
Modified: trunk/core/ChangeLog
===================================================================
--- trunk/core/ChangeLog 2017-01-04 16:29:02 UTC (rev 4314)
+++ trunk/core/ChangeLog 2017-01-05 17:09:59 UTC (rev 4315)
@@ -6,6 +6,7 @@
* fix gcc (4.9) compile-error when compiling with "-Werror"
* after a connection has been closed, the unused file of the
unix domain socket has to be removed from the filesystem
+ * log path of the unix domain socket file, if it can't be created
2016-10-22 Mark Ellis <ma...@mp...>
Modified: trunk/core/dccm/synce-connection-broker.c
===================================================================
--- trunk/core/dccm/synce-connection-broker.c 2017-01-04 16:29:02 UTC (rev 4314)
+++ trunk/core/dccm/synce-connection-broker.c 2017-01-05 17:09:59 UTC (rev 4315)
@@ -242,7 +242,7 @@
}
if (!(g_socket_listener_add_address(G_SOCKET_LISTENER(priv->server), sock_address, G_SOCKET_TYPE_STREAM, G_SOCKET_PROTOCOL_DEFAULT, NULL, NULL, &error))) {
- g_critical("%s: failed to add address to socket service: %s", G_STRFUNC, error->message);
+ g_critical("%s: failed to add address %s to socket service: %s", G_STRFUNC, priv->filename, error->message);
goto error_exit;
}
g_object_unref(sock_address);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <maj...@us...> - 2017-01-04 16:29:05
|
Revision: 4314
http://sourceforge.net/p/synce/code/4314
Author: majestro
Date: 2017-01-04 16:29:02 +0000 (Wed, 04 Jan 2017)
Log Message:
-----------
after a connection has been closed, the unused file of the unix domain socket has to be removed from the filesystem
Modified Paths:
--------------
trunk/core/ChangeLog
trunk/core/dccm/synce-connection-broker.c
Modified: trunk/core/ChangeLog
===================================================================
--- trunk/core/ChangeLog 2017-01-04 02:30:53 UTC (rev 4313)
+++ trunk/core/ChangeLog 2017-01-04 16:29:02 UTC (rev 4314)
@@ -1,3 +1,12 @@
+2017-01-05 Arndt Kaiser
+
+ * fixed infinite loop in synce-serial-chat,
+ if stdin has been closed and read() returns 0
+ * add missing python-modules in synceconnector
+ * fix gcc (4.9) compile-error when compiling with "-Werror"
+ * after a connection has been closed, the unused file of the
+ unix domain socket has to be removed from the filesystem
+
2016-10-22 Mark Ellis <ma...@mp...>
* add dbus properties for static device properties
Modified: trunk/core/dccm/synce-connection-broker.c
===================================================================
--- trunk/core/dccm/synce-connection-broker.c 2017-01-04 02:30:53 UTC (rev 4313)
+++ trunk/core/dccm/synce-connection-broker.c 2017-01-04 16:29:02 UTC (rev 4314)
@@ -138,7 +138,10 @@
SynceConnectionBroker *self = SYNCE_CONNECTION_BROKER (obj);
SynceConnectionBrokerPrivate *priv = SYNCE_CONNECTION_BROKER_GET_PRIVATE (self);
- g_free (priv->filename);
+ if (priv->filename != NULL) {
+ unlink (priv->filename);
+ g_free (priv->filename);
+ }
G_OBJECT_CLASS (synce_connection_broker_parent_class)->finalize (obj);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <maj...@us...> - 2017-01-04 02:30:55
|
Revision: 4313
http://sourceforge.net/p/synce/code/4313
Author: majestro
Date: 2017-01-04 02:30:53 +0000 (Wed, 04 Jan 2017)
Log Message:
-----------
fix gcc (4.9) compile-error when compiling with "-Werror"
Modified Paths:
--------------
trunk/core/dccm/synce-device-manager.c
Modified: trunk/core/dccm/synce-device-manager.c
===================================================================
--- trunk/core/dccm/synce-device-manager.c 2017-01-03 21:19:23 UTC (rev 4312)
+++ trunk/core/dccm/synce-device-manager.c 2017-01-04 02:30:53 UTC (rev 4313)
@@ -561,7 +561,7 @@
device_entry_iter = g_slist_next(device_entry_iter);
}
- synce_dbus_device_manager_complete_get_connected_devices(interface, invocation, device_list);
+ synce_dbus_device_manager_complete_get_connected_devices(interface, invocation, (const gchar**)device_list);
g_strfreev(device_list);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <maj...@us...> - 2017-01-03 21:19:26
|
Revision: 4312
http://sourceforge.net/p/synce/code/4312
Author: majestro
Date: 2017-01-03 21:19:23 +0000 (Tue, 03 Jan 2017)
Log Message:
-----------
add missing python-modules
Modified Paths:
--------------
trunk/core/scripts/synceconnector.py.in
Modified: trunk/core/scripts/synceconnector.py.in
===================================================================
--- trunk/core/scripts/synceconnector.py.in 2017-01-03 20:49:34 UTC (rev 4311)
+++ trunk/core/scripts/synceconnector.py.in 2017-01-03 21:19:23 UTC (rev 4312)
@@ -2,6 +2,8 @@
import os
import stat
import platform
+import signal
+import time
import re
import subprocess
import logging, logging.handlers
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <maj...@us...> - 2017-01-03 20:49:35
|
Revision: 4311
http://sourceforge.net/p/synce/code/4311
Author: majestro
Date: 2017-01-03 20:49:34 +0000 (Tue, 03 Jan 2017)
Log Message:
-----------
fixed infinite loop if stdin has been closed and read() returns 0
Modified Paths:
--------------
trunk/core/dccm/synce-serial-chat.c
Modified: trunk/core/dccm/synce-serial-chat.c
===================================================================
--- trunk/core/dccm/synce-serial-chat.c 2016-11-25 14:31:49 UTC (rev 4310)
+++ trunk/core/dccm/synce-serial-chat.c 2017-01-03 20:49:34 UTC (rev 4311)
@@ -37,7 +37,7 @@
{
bytes_read = read(STDIN_FILENO, buffer+bytes_read_total, bytes_left);
- if (bytes_read < 0)
+ if (bytes_read <= 0)
break;
bytes_left -= bytes_read;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2016-11-25 14:31:51
|
Revision: 4310
http://sourceforge.net/p/synce/code/4310
Author: mark_ellis
Date: 2016-11-25 14:31:49 +0000 (Fri, 25 Nov 2016)
Log Message:
-----------
fixed parameter initialisation for 3 calls in rapiwrapper.h, thanks to dcb
Modified Paths:
--------------
trunk/kde4-kcemirror/ChangeLog
trunk/kde4-kcemirror/kcemirror/rapiwrapper.h
Modified: trunk/kde4-kcemirror/ChangeLog
===================================================================
--- trunk/kde4-kcemirror/ChangeLog 2016-10-22 12:26:27 UTC (rev 4309)
+++ trunk/kde4-kcemirror/ChangeLog 2016-11-25 14:31:49 UTC (rev 4310)
@@ -1,3 +1,8 @@
+2016-11-25 Mark Ellis <ma...@mp...>
+
+ * fixed parameter initialisation for 3 calls in rapiwrapper.h, thanks
+ to dcb
+
2013-07-25 Mark Ellis <ma...@mp...>
* 0.2 release
Modified: trunk/kde4-kcemirror/kcemirror/rapiwrapper.h
===================================================================
--- trunk/kde4-kcemirror/kcemirror/rapiwrapper.h 2016-10-22 12:26:27 UTC (rev 4309)
+++ trunk/kde4-kcemirror/kcemirror/rapiwrapper.h 2016-11-25 14:31:49 UTC (rev 4310)
@@ -274,7 +274,7 @@
static bool getVersionEx(synce::CEOSVERSIONINFO *version)
{
- memset(version, 0, sizeof(version));
+ memset(version, 0, sizeof(*version));
version->dwOSVersionInfoSize = sizeof(version);
return synce::IRAPISession_CeGetVersionEx(session, version);
@@ -283,7 +283,7 @@
static void getSystemInfo(synce::SYSTEM_INFO *system)
{
- memset(system, 0, sizeof(system));
+ memset(system, 0, sizeof(*system));
synce::IRAPISession_CeGetSystemInfo(session, system);
}
@@ -298,7 +298,7 @@
static bool getStoreInformation(synce::STORE_INFORMATION *store)
{
- memset(store, 0, sizeof(store));
+ memset(store, 0, sizeof(*store));
return synce::IRAPISession_CeGetStoreInformation(session, store);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2016-10-22 12:26:29
|
Revision: 4309
http://sourceforge.net/p/synce/code/4309
Author: mark_ellis
Date: 2016-10-22 12:26:27 +0000 (Sat, 22 Oct 2016)
Log Message:
-----------
improve process of establishing initial connection in DeviceManager
Modified Paths:
--------------
trunk/core/ChangeLog
trunk/core/dccm/synce-device-manager.c
trunk/core/dccm/utils.c
trunk/core/dccm/utils.h
Modified: trunk/core/ChangeLog
===================================================================
--- trunk/core/ChangeLog 2016-10-22 12:20:23 UTC (rev 4308)
+++ trunk/core/ChangeLog 2016-10-22 12:26:27 UTC (rev 4309)
@@ -9,6 +9,8 @@
DeviceManagerControl
* use gio functions for socket transfer of file descriptors
for ease of maintenance
+ * improve process of establishing initial connection in
+ DeviceManager
2016-10-10 Mark Ellis <ma...@mp...>
Modified: trunk/core/dccm/synce-device-manager.c
===================================================================
--- trunk/core/dccm/synce-device-manager.c 2016-10-22 12:20:23 UTC (rev 4308)
+++ trunk/core/dccm/synce-device-manager.c 2016-10-22 12:26:27 UTC (rev 4309)
@@ -304,52 +304,82 @@
}
+static void
+trigger_device_connection (const gchar *device_ip)
+{
+ GSocket *sock = NULL;
+ GInetAddress *inet_address = NULL;
+ GSocketAddress *sock_address = NULL;
+ GError *error = NULL;
+ gchar b = 0x7f;
+
+ sock = g_socket_new (G_SOCKET_FAMILY_IPV4, G_SOCKET_TYPE_DATAGRAM, G_SOCKET_PROTOCOL_DEFAULT, &error);
+ if (!sock) {
+ g_warning ("%s: failed to create socket: %s", G_STRFUNC, error->message);
+ goto exit;
+ }
+
+ if (!(inet_address = g_inet_address_new_from_string(device_ip))) {
+ g_critical("%s: failed to parse ip address: %s", G_STRFUNC, device_ip);
+ goto exit;
+ }
+ sock_address = g_inet_socket_address_new(inet_address, 5679);
+
+ if (g_socket_send_to (sock, sock_address, &b, sizeof(b), NULL, &error) != 1) {
+ g_critical("%s: failed to send on socket: %s", G_STRFUNC, error->message);
+ goto exit;
+ }
+
+exit:
+ if (sock) g_object_unref(sock);
+ if (inet_address) g_object_unref(inet_address);
+ if (sock_address) g_object_unref(sock_address);
+
+ return;
+}
+
+
static gboolean
synce_device_manager_create_device(SynceDeviceManager *self,
- const gchar *local_ip,
+ GInetAddress *local_addr,
DeviceEntry *deventry)
{
SynceDeviceManagerPrivate *priv = SYNCE_DEVICE_MANAGER_GET_PRIVATE(self);
g_return_val_if_fail(priv->inited && !(priv->dispose_has_run), FALSE);
+ GSocketAddress *sock_address = NULL;
+ GError *error = NULL;
+
g_debug("%s: found device interface for %s", G_STRFUNC, deventry->device_path);
deventry->iface_pending = FALSE;
- GError *error = NULL;
- GSocket *socket_990 = NULL;
- GSocket *socket_5679 = NULL;
-
- if (!(socket_990 = synce_create_socket(local_ip, 990))) {
- g_critical("%s: failed to create listening socket on rndis port (990)", G_STRFUNC);
- goto error_exit;
- }
-
- if (!(socket_5679 = synce_create_socket(local_ip, 5679))) {
- g_critical("%s: failed to create listening socket on legacy port (5679)", G_STRFUNC);
- goto error_exit;
- }
-
deventry->server = g_socket_service_new();
if (!(deventry->server)) {
g_critical("%s: failed to create socket service", G_STRFUNC);
goto error_exit;
}
- if (!(g_socket_listener_add_socket(G_SOCKET_LISTENER(deventry->server), socket_990, NULL, &error))) {
- g_critical("%s: failed to add 990 socket to socket service: %s", G_STRFUNC, error->message);
+ sock_address = g_inet_socket_address_new(local_addr, 990);
+ if (!(g_socket_listener_add_address(G_SOCKET_LISTENER(deventry->server),
+ sock_address, G_SOCKET_TYPE_STREAM, G_SOCKET_PROTOCOL_TCP,
+ NULL, NULL, &error))) {
+ g_critical("%s: failed to add port 990 socket to socket service: %s", G_STRFUNC, error->message);
g_error_free(error);
goto error_exit;
}
- if (!(g_socket_listener_add_socket(G_SOCKET_LISTENER(deventry->server), socket_5679, NULL, &error))) {
- g_critical("%s: failed to add 5679 socket to socket service: %s", G_STRFUNC, error->message);
+ g_object_unref(sock_address);
+ sock_address = g_inet_socket_address_new(local_addr, 5679);
+ if (!(g_socket_listener_add_address(G_SOCKET_LISTENER(deventry->server),
+ sock_address, G_SOCKET_TYPE_STREAM, G_SOCKET_PROTOCOL_TCP,
+ NULL, NULL, &error))) {
+ g_critical("%s: failed to add port 5679 socket to socket service: %s", G_STRFUNC, error->message);
g_error_free(error);
goto error_exit;
}
- g_object_unref(socket_990);
- g_object_unref(socket_5679);
+ g_object_unref(sock_address);
g_signal_connect(deventry->server, "incoming", G_CALLBACK(synce_device_manager_client_connected_cb), self);
@@ -359,7 +389,7 @@
if (deventry->rndis) {
g_debug("%s: triggering connection", G_STRFUNC);
- synce_trigger_connection(deventry->device_ip);
+ trigger_device_connection(deventry->device_ip);
} else {
g_debug("%s: NOT triggering connection", G_STRFUNC);
}
@@ -367,15 +397,14 @@
return TRUE;
error_exit:
- if (socket_990) g_object_unref(socket_990);
- if (socket_5679) g_object_unref(socket_5679);
+ if (sock_address) g_object_unref(sock_address);
if (deventry->server) g_object_unref(deventry->server);
return FALSE;
}
static gboolean
-synce_device_manager_check_interface_cb (gpointer userdata)
+synce_device_manager_check_interfaces_cb (gpointer userdata)
{
SynceDeviceManager *self = SYNCE_DEVICE_MANAGER(userdata);
SynceDeviceManagerPrivate *priv = SYNCE_DEVICE_MANAGER_GET_PRIVATE(self);
@@ -386,8 +415,13 @@
device_entry_iter = priv->devices;
while (device_entry_iter) {
- gchar *local_ip = ((DeviceEntry*)device_entry_iter->data)->local_ip;
+ if ( !((DeviceEntry*)device_entry_iter->data)->iface_pending ) {
+ device_entry_iter = g_slist_next(device_entry_iter);
+ continue;
+ }
+ const gchar *local_ip = ((DeviceEntry*)device_entry_iter->data)->local_ip;
+
GSocket *socket = g_socket_new(G_SOCKET_FAMILY_IPV4, G_SOCKET_TYPE_STREAM, G_SOCKET_PROTOCOL_DEFAULT, &error);
if (!socket) {
g_critical("%s: failed to create a socket: %s", G_STRFUNC, error->message);
@@ -401,7 +435,7 @@
if (g_socket_bind(socket, G_SOCKET_ADDRESS(sockaddr), TRUE, &error)) {
g_debug("%s: address ready", G_STRFUNC);
g_object_unref(socket);
- synce_device_manager_create_device(self, ((DeviceEntry*)device_entry_iter->data)->local_ip, device_entry_iter->data);
+ synce_device_manager_create_device(self, local_addr, device_entry_iter->data);
} else {
g_debug("%s: address not yet ready, failed to bind: %s", G_STRFUNC, error->message);
g_error_free(error);
@@ -461,7 +495,7 @@
if (priv->iface_check_id > 0)
return;
- priv->iface_check_id = g_timeout_add (100, synce_device_manager_check_interface_cb, self);
+ priv->iface_check_id = g_timeout_add (100, synce_device_manager_check_interfaces_cb, self);
}
Modified: trunk/core/dccm/utils.c
===================================================================
--- trunk/core/dccm/utils.c 2016-10-22 12:20:23 UTC (rev 4308)
+++ trunk/core/dccm/utils.c 2016-10-22 12:26:27 UTC (rev 4309)
@@ -2,14 +2,6 @@
#include "config.h"
#endif
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <sys/ioctl.h>
#include <synce.h>
#include <glib.h>
#include <gio/gio.h>
@@ -173,82 +165,3 @@
return ret;
}
-gboolean
-synce_trigger_connection (const gchar *device_ip)
-{
- gboolean result = FALSE;
- gint fd = -1;
- struct sockaddr_in sa;
- guchar b = 0x7f;
-
- if ((fd = socket (AF_INET, SOCK_DGRAM, 0)) < 0) {
- g_warning ("%s: failed to create socket: %s", G_STRFUNC, strerror (errno));
- goto exit;
- }
-
- sa.sin_family = AF_INET;
- sa.sin_port = htons (5679);
- inet_aton (device_ip, &sa.sin_addr);
-
- if (sendto (fd, &b, sizeof (b), 0, (const struct sockaddr *) &sa,
- sizeof (sa)) != 1)
- {
- g_warning ("%s: failed to send on socket: %s", G_STRFUNC, strerror (errno));
- goto exit;
- }
-
- result = TRUE;
-
-exit:
- if (fd != -1)
- close (fd);
-
- return result;
-}
-
-GSocket *
-synce_create_socket(const gchar *address, guint16 port)
-{
- GError *error = NULL;
- GSocket *socket = NULL;
- GInetAddress *inet_address = NULL;
- GSocketAddress *sock_address = NULL;
-
- if (!(inet_address = g_inet_address_new_from_string(address))) {
- g_critical("%s: failed to parse ip address: %s", G_STRFUNC, address);
- goto error_exit;
- }
-
- socket = g_socket_new(G_SOCKET_FAMILY_IPV4, G_SOCKET_TYPE_STREAM, G_SOCKET_PROTOCOL_TCP, &error);
- if (!socket) {
- g_critical("%s: failed to create socket: %s", G_STRFUNC, error->message);
- goto error_exit;
- }
- if (!(g_initable_init(G_INITABLE(socket), NULL, &error))) {
- g_critical("%s: failed to initialise socket: %s", G_STRFUNC, error->message);
- g_object_unref(socket);
- goto error_exit;
- }
- sock_address = g_inet_socket_address_new(inet_address, port);
- if (!(g_socket_bind(socket, sock_address, TRUE, &error))) {
- g_critical("%s: failed to bind to port %u: %s", G_STRFUNC, port, error->message);
- g_object_unref(socket);
- goto error_exit;
- }
- if (!(g_socket_listen(socket, &error))) {
- g_critical("%s: failed to listen to port %u: %s", G_STRFUNC, port, error->message);
- g_object_unref(socket);
- goto error_exit;
- }
-
- g_object_unref(sock_address);
- g_object_unref(inet_address);
- return socket;
-
- error_exit:
- if (error) g_error_free(error);
- if (inet_address) g_object_unref(inet_address);
- if (sock_address) g_object_unref(sock_address);
-
- return NULL;
-}
Modified: trunk/core/dccm/utils.h
===================================================================
--- trunk/core/dccm/utils.h 2016-10-22 12:20:23 UTC (rev 4308)
+++ trunk/core/dccm/utils.h 2016-10-22 12:26:27 UTC (rev 4309)
@@ -1,5 +1,4 @@
#include <glib.h>
-#include <gio/gio.h>
void
synce_get_dbus_sender_uid (const gchar *sender, guint *uid);
@@ -19,8 +18,3 @@
gchar *
synce_rapi_unicode_string_to_string_at_offset (const guchar *buf, const guchar *offset, const guchar *buf_max);
-gboolean
-synce_trigger_connection (const gchar *device_ip);
-
-GSocket *
-synce_create_socket(const gchar *address, guint16 port);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|