File: diff_as_of_1.07-10.1_trickle.c.patch

package info (click to toggle)
trickle 1.08%2Bds-1.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 584 kB
  • sloc: ansic: 4,923; makefile: 46
file content (62 lines) | stat: -rw-r--r-- 1,733 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
Description: Changes to trickle.c as of trickle 1.07-10.1

--- trickle-1.07.orig/trickle.c
+++ trickle-1.07/trickle.c
@@ -46,18 +46,14 @@
 	    *uplim = "10", *downlim = "10", *tsmooth = "3.0", *lsmooth = "20",
 	    *latency = "0";
 	int opt, verbose = 0, standalone = 0;
-	char buf[MAXPATHLEN], sockname[MAXPATHLEN], *path, **pathp;
+	char buf[MAXPATHLEN], sockname[MAXPATHLEN], **pathp;
 	struct stat sb;
-	char *trypaths[]  = {
-		LIBNAME,
-		LIBDIR "/" LIBNAME,
-		NULL
-	};
+	char *path = LIBDIR "/" LIBNAME;
 
 	__progname = get_progname(argv[0]);
 	sockname[0] = '\0';
 
-	while ((opt = getopt(argc, argv, "hvVsw:n:u:d:t:l:L:")) != -1)
+	while ((opt = getopt(argc, argv, "hvVsw:n:u:d:t:l:L:P:")) != -1)
                 switch (opt) {
 		case 'v':
 			verbose++;
@@ -86,6 +82,9 @@
 		case 's':
 			standalone = 1;
 			break;
+		case 'P':
+			path = optarg;
+			break;
 		case 'L':
 			latency = optarg;
 			break;
@@ -100,13 +99,9 @@
 	if (argc == 0)
 		usage();
 
-	for (pathp = trypaths; *pathp != NULL; pathp++)
-		if (lstat(*pathp, &sb) == 0)
-			break;
-
-	path = *pathp;
-	if (path == NULL)
+	if (lstat(path, &sb) != 0) {
 		errx(1, "Could not find overload object");
+	}
 
 	if (path[0] != '/') {
 		if (getcwd(buf, sizeof(buf)) == NULL)
@@ -167,7 +162,8 @@
 	    "\t-t <seconds> Set default smoothing time to <seconds> s\n"
 	    "\t-l <length>  Set default smoothing length to <length> KB\n"
 	    "\t-n <path>    Use trickled socket name <path>\n"
-	    "\t-L <ms>      Set latency to <ms> milliseconds\n",
+	    "\t-L <ms>      Set latency to <ms> milliseconds\n"
+		"\t-P <path>    Preload the specified .so instead of the default one\n",
 	    __progname, (int)strlen(__progname), ' ', __progname);
 
 	exit(1);