diff options
| author | Mario Domenech Goulart <mario@ossystems.com.br> | 2015-03-10 18:10:20 -0300 |
|---|---|---|
| committer | Otavio Salvador <otavio@ossystems.com.br> | 2015-03-11 10:43:53 -0300 |
| commit | a3ede8721f19af849c6a23e3f8e60485ef9f30df (patch) | |
| tree | 21bbd62543d69e3dff1d02c8e728ca5155b14de0 /recipes-extended/rxtx/files/fix_snprintf.patch | |
| parent | bd9c60238c4c62d9a0f2d60b89aef429a1b71e34 (diff) | |
| download | meta-java-a3ede8721f19af849c6a23e3f8e60485ef9f30df.tar.gz | |
rxtx: update to the latest Debian patchset
Update the recipe to apply all patches available from
git://anonscm.debian.org/pkg-java/rxtx.git as of
a4cd13e04254cea7842df2e30e9d12e9765a3ef9.
Signed-off-by: Mario Domenech Goulart <mario@ossystems.com.br>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Diffstat (limited to 'recipes-extended/rxtx/files/fix_snprintf.patch')
| -rw-r--r-- | recipes-extended/rxtx/files/fix_snprintf.patch | 399 |
1 files changed, 399 insertions, 0 deletions
diff --git a/recipes-extended/rxtx/files/fix_snprintf.patch b/recipes-extended/rxtx/files/fix_snprintf.patch new file mode 100644 index 0000000..704a2c4 --- /dev/null +++ b/recipes-extended/rxtx/files/fix_snprintf.patch | |||
| @@ -0,0 +1,399 @@ | |||
| 1 | From: Jose Luis Guardiola <guardiola@iti.upv.es> | ||
| 2 | Forwarded: no | ||
| 3 | Description: replace s[n]printf with asprintf/free | ||
| 4 | Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=731151 | ||
| 5 | Upstream-Status: Pending | ||
| 6 | |||
| 7 | --- a/src/SerialImp.c | ||
| 8 | +++ b/src/SerialImp.c | ||
| 9 | @@ -5827,7 +5827,7 @@ | ||
| 10 | LOCKDIR, NULL | ||
| 11 | }; | ||
| 12 | const char *lockprefixes[] = { "LCK..", "lk..", "LK.", NULL }; | ||
| 13 | - char *p, file[80], pid_buffer[20], message[80]; | ||
| 14 | + char *p, *file, pid_buffer[20], *message; | ||
| 15 | int i = 0, j, k, fd , pid; | ||
| 16 | struct stat buf, buf2, lockbuf; | ||
| 17 | |||
| 18 | @@ -5868,19 +5868,22 @@ | ||
| 19 | while ( lockprefixes[k] ) | ||
| 20 | { | ||
| 21 | /* FHS style */ | ||
| 22 | - sprintf( file, "%s/%s%s", lockdirs[i], | ||
| 23 | + asprintf( &file, "%s/%s%s", lockdirs[i], | ||
| 24 | lockprefixes[k], p ); | ||
| 25 | if( stat( file, &buf ) == 0 ) | ||
| 26 | { | ||
| 27 | - sprintf( message, UNEXPECTED_LOCK_FILE, | ||
| 28 | + asprintf( &message, UNEXPECTED_LOCK_FILE, | ||
| 29 | file ); | ||
| 30 | report_warning( message ); | ||
| 31 | + free( message ); | ||
| 32 | + free( file ); | ||
| 33 | return 1; | ||
| 34 | } | ||
| 35 | + free( file ); | ||
| 36 | |||
| 37 | /* UUCP style */ | ||
| 38 | stat(port_filename , &buf ); | ||
| 39 | - sprintf( file, "%s/%s%03d.%03d.%03d", | ||
| 40 | + asprintf( &file, "%s/%s%03d.%03d.%03d", | ||
| 41 | lockdirs[i], | ||
| 42 | lockprefixes[k], | ||
| 43 | (int) major( buf.st_dev ), | ||
| 44 | @@ -5889,11 +5892,14 @@ | ||
| 45 | ); | ||
| 46 | if( stat( file, &buf ) == 0 ) | ||
| 47 | { | ||
| 48 | - sprintf( message, UNEXPECTED_LOCK_FILE, | ||
| 49 | + asprintf( &message, UNEXPECTED_LOCK_FILE, | ||
| 50 | file ); | ||
| 51 | report_warning( message ); | ||
| 52 | + free( message ); | ||
| 53 | + free( file ); | ||
| 54 | return 1; | ||
| 55 | } | ||
| 56 | + free( file ); | ||
| 57 | k++; | ||
| 58 | } | ||
| 59 | } | ||
| 60 | @@ -5917,7 +5923,7 @@ | ||
| 61 | #endif /* __unixware__ */ | ||
| 62 | p--; | ||
| 63 | } | ||
| 64 | - sprintf( file, "%s/%s%s", LOCKDIR, LOCKFILEPREFIX, p ); | ||
| 65 | + asprintf( &file, "%s/%s%s", LOCKDIR, LOCKFILEPREFIX, p ); | ||
| 66 | #else | ||
| 67 | /* UUCP standard locks */ | ||
| 68 | if ( stat( port_filename, &buf ) != 0 ) | ||
| 69 | @@ -5925,7 +5931,7 @@ | ||
| 70 | report( "RXTX is_device_locked() could not find device.\n" ); | ||
| 71 | return 1; | ||
| 72 | } | ||
| 73 | - sprintf( file, "%s/LK.%03d.%03d.%03d", | ||
| 74 | + asprintf( &file, "%s/LK.%03d.%03d.%03d", | ||
| 75 | LOCKDIR, | ||
| 76 | (int) major( buf.st_dev ), | ||
| 77 | (int) major( buf.st_rdev ), | ||
| 78 | @@ -5946,21 +5952,25 @@ | ||
| 79 | |||
| 80 | if( kill( (pid_t) pid, 0 ) && errno==ESRCH ) | ||
| 81 | { | ||
| 82 | - sprintf( message, | ||
| 83 | + asprintf( &message, | ||
| 84 | "RXTX Warning: Removing stale lock file. %s\n", | ||
| 85 | file ); | ||
| 86 | report_warning( message ); | ||
| 87 | + free( message ); | ||
| 88 | if( unlink( file ) != 0 ) | ||
| 89 | { | ||
| 90 | - snprintf( message, 80, "RXTX Error: Unable to \ | ||
| 91 | + asprintf( &message, "RXTX Error: Unable to \ | ||
| 92 | remove stale lock file: %s\n", | ||
| 93 | file | ||
| 94 | ); | ||
| 95 | report_warning( message ); | ||
| 96 | + free( message ); | ||
| 97 | + free( file ); | ||
| 98 | return 1; | ||
| 99 | } | ||
| 100 | } | ||
| 101 | } | ||
| 102 | + free(file); | ||
| 103 | return 0; | ||
| 104 | } | ||
| 105 | #endif /* WIN32 */ | ||
| 106 | --- a/src/lfd/lockdaemon.c | ||
| 107 | +++ b/src/lfd/lockdaemon.c | ||
| 108 | @@ -120,8 +120,8 @@ | ||
| 109 | * | ||
| 110 | */ | ||
| 111 | int fd,j; | ||
| 112 | - char lockinfo[12], message[80]; | ||
| 113 | - char file[80], *p; | ||
| 114 | + char lockinfo[12]; | ||
| 115 | + char *file, *p, *message; | ||
| 116 | |||
| 117 | j = strlen( filename ); | ||
| 118 | p = ( char * ) filename + j; | ||
| 119 | @@ -136,24 +136,28 @@ | ||
| 120 | #endif /* __unixware__ */ | ||
| 121 | p--; | ||
| 122 | } | ||
| 123 | - sprintf( file, "%s/LCK..%s", LOCKDIR, p ); | ||
| 124 | if ( check_lock_status( filename ) ) | ||
| 125 | { | ||
| 126 | /* syslog( LOG_INFO, "fhs_lock() lockstatus fail\n" ); */ | ||
| 127 | return 1; | ||
| 128 | } | ||
| 129 | + asprintf( &file, "%s/LCK..%s", LOCKDIR, p ); | ||
| 130 | fd = open( file, O_CREAT | O_WRONLY | O_EXCL, 0444 ); | ||
| 131 | if( fd < 0 ) | ||
| 132 | { | ||
| 133 | - snprintf( message, 79, | ||
| 134 | + asprintf( &message, | ||
| 135 | "RXTX fhs_lock() Error: creating lock file: %s: %s\n", | ||
| 136 | file, strerror(errno) ); | ||
| 137 | syslog( LOG_INFO, message ); | ||
| 138 | + free(message); | ||
| 139 | + free(file); | ||
| 140 | return 1; | ||
| 141 | } | ||
| 142 | sprintf( lockinfo, "%10d\n", pid ); | ||
| 143 | - sprintf( message, "fhs_lock: creating lockfile: %s\n", lockinfo ); | ||
| 144 | + //asprintf( &message, "fhs_lock: creating lockfile: %s\n", lockinfo ); | ||
| 145 | //syslog( LOG_INFO, message ); | ||
| 146 | + //free(message); | ||
| 147 | + free(file); | ||
| 148 | write( fd, lockinfo, 11 ); | ||
| 149 | close( fd ); | ||
| 150 | return 0; | ||
| 151 | @@ -563,7 +567,7 @@ | ||
| 152 | LOCKDIR, NULL | ||
| 153 | }; | ||
| 154 | const char *lockprefixes[] = { "LCK..", "lk..", "LK.", NULL }; | ||
| 155 | - char *p, file[80], pid_buffer[20], message[80]; | ||
| 156 | + char *p, *file, pid_buffer[20], *message; | ||
| 157 | int i = 0, j, k, fd , pid; | ||
| 158 | struct stat buf; | ||
| 159 | struct stat buf2; | ||
| 160 | @@ -602,19 +606,22 @@ | ||
| 161 | while ( lockprefixes[k] ) | ||
| 162 | { | ||
| 163 | /* FHS style */ | ||
| 164 | - sprintf( file, "%s/%s%s", lockdirs[i], | ||
| 165 | + asprintf( &file, "%s/%s%s", lockdirs[i], | ||
| 166 | lockprefixes[k], p ); | ||
| 167 | if( stat( file, &buf ) == 0 ) | ||
| 168 | { | ||
| 169 | - sprintf( message, UNEXPECTED_LOCK_FILE, | ||
| 170 | + asprintf( &message, UNEXPECTED_LOCK_FILE, | ||
| 171 | file ); | ||
| 172 | syslog( LOG_INFO, message ); | ||
| 173 | + free( message ); | ||
| 174 | + free( file ); | ||
| 175 | return 1; | ||
| 176 | } | ||
| 177 | + free( file ); | ||
| 178 | |||
| 179 | /* UUCP style */ | ||
| 180 | stat(port_filename , &buf ); | ||
| 181 | - sprintf( file, "%s/%s%03d.%03d.%03d", | ||
| 182 | + asprintf( &file, "%s/%s%03d.%03d.%03d", | ||
| 183 | lockdirs[i], | ||
| 184 | lockprefixes[k], | ||
| 185 | (int) major( buf.st_dev ), | ||
| 186 | @@ -623,11 +630,14 @@ | ||
| 187 | ); | ||
| 188 | if( stat( file, &buf ) == 0 ) | ||
| 189 | { | ||
| 190 | - sprintf( message, UNEXPECTED_LOCK_FILE, | ||
| 191 | + asprintf( &message, UNEXPECTED_LOCK_FILE, | ||
| 192 | file ); | ||
| 193 | syslog( LOG_INFO, message ); | ||
| 194 | + free( message ); | ||
| 195 | + free( file ); | ||
| 196 | return 1; | ||
| 197 | } | ||
| 198 | + free( file ); | ||
| 199 | k++; | ||
| 200 | } | ||
| 201 | } | ||
| 202 | @@ -651,10 +661,10 @@ | ||
| 203 | #endif /* __unixware__ */ | ||
| 204 | p--; | ||
| 205 | } | ||
| 206 | - sprintf( file, "%s/%s%s", LOCKDIR, LOCKFILEPREFIX, p ); | ||
| 207 | + asprintf( &file, "%s/%s%s", LOCKDIR, LOCKFILEPREFIX, p ); | ||
| 208 | #else | ||
| 209 | /* UUCP standard locks */ | ||
| 210 | - sprintf( file, "%s/LK.%03d.%03d.%03d", | ||
| 211 | + asprintf( &file, "%s/LK.%03d.%03d.%03d", | ||
| 212 | LOCKDIR, | ||
| 213 | (int) major( buf.st_dev ), | ||
| 214 | (int) major( buf.st_rdev ), | ||
| 215 | @@ -672,32 +682,39 @@ | ||
| 216 | /* FIXME null terminiate pid_buffer? need to check in Solaris */ | ||
| 217 | close( fd ); | ||
| 218 | sscanf( pid_buffer, "%d", &pid ); | ||
| 219 | - sprintf( message, "found lock for %s with pid %i\n", file, pid ); | ||
| 220 | + /* asprintf( &message, "found lock for %s with pid %i\n", file, pid ); */ | ||
| 221 | /* syslog( LOG_INFO, message ); */ | ||
| 222 | + /* free( message ); */ | ||
| 223 | |||
| 224 | if( kill( (pid_t) pid, 0 ) && errno==ESRCH ) | ||
| 225 | { | ||
| 226 | - sprintf( message, | ||
| 227 | + asprintf( &message, | ||
| 228 | "RXTX Warning: Removing stale lock file. %s\n", | ||
| 229 | file ); | ||
| 230 | syslog( LOG_INFO, message ); | ||
| 231 | + free( message ); | ||
| 232 | if( unlink( file ) != 0 ) | ||
| 233 | { | ||
| 234 | - snprintf( message, 80, "RXTX Error: Unable to \ | ||
| 235 | + asprintf( &message, "RXTX Error: Unable to \ | ||
| 236 | remove stale lock file: %s\n", | ||
| 237 | file | ||
| 238 | ); | ||
| 239 | syslog( LOG_INFO, message ); | ||
| 240 | + free( message ); | ||
| 241 | + free( file ); | ||
| 242 | return 0; | ||
| 243 | } | ||
| 244 | } | ||
| 245 | else | ||
| 246 | { | ||
| 247 | - sprintf( message, "could not kill %i\n", pid ); | ||
| 248 | + /* asprintf( &message, "could not kill %i\n", pid ); */ | ||
| 249 | /* syslog( LOG_INFO, message ); */ | ||
| 250 | + /* free( message ); */ | ||
| 251 | + free( file ); | ||
| 252 | return 1; | ||
| 253 | } | ||
| 254 | } | ||
| 255 | + free( file ); | ||
| 256 | return 0; | ||
| 257 | } | ||
| 258 | int init( void ) | ||
| 259 | --- a/src/lfd/lockdaemon.c.noinetd | ||
| 260 | +++ b/src/lfd/lockdaemon.c.noinetd | ||
| 261 | @@ -119,8 +119,8 @@ | ||
| 262 | * | ||
| 263 | */ | ||
| 264 | int fd,j; | ||
| 265 | - char lockinfo[12], message[80]; | ||
| 266 | - char file[80], *p; | ||
| 267 | + char lockinfo[12]; | ||
| 268 | + char *file, *p, *message; | ||
| 269 | |||
| 270 | j = strlen( filename ); | ||
| 271 | p = ( char * ) filename + j; | ||
| 272 | @@ -135,24 +135,28 @@ | ||
| 273 | #endif /* __unixware__ */ | ||
| 274 | p--; | ||
| 275 | } | ||
| 276 | - sprintf( file, "%s/LCK..%s", LOCKDIR, p ); | ||
| 277 | if ( check_lock_status( filename ) ) | ||
| 278 | { | ||
| 279 | syslog( LOG_INFO, "fhs_lock() lockstatus fail\n" ); | ||
| 280 | return 1; | ||
| 281 | } | ||
| 282 | + asprintf( &file, "%s/LCK..%s", LOCKDIR, p ); | ||
| 283 | fd = open( file, O_CREAT | O_WRONLY | O_EXCL, 0444 ); | ||
| 284 | if( fd < 0 ) | ||
| 285 | { | ||
| 286 | - snprintf( message, 79, | ||
| 287 | + asprintf( &message, | ||
| 288 | "RXTX fhs_lock() Error: creating lock file: %s: %s\n", | ||
| 289 | file, strerror(errno) ); | ||
| 290 | syslog( LOG_INFO, message ); | ||
| 291 | + free(message); | ||
| 292 | + free(file); | ||
| 293 | return 1; | ||
| 294 | } | ||
| 295 | sprintf( lockinfo, "%10d\n", pid ); | ||
| 296 | - sprintf( message, "fhs_lock: creating lockfile: %s\n", lockinfo ); | ||
| 297 | + asprintf( &message, "fhs_lock: creating lockfile: %s\n", lockinfo ); | ||
| 298 | syslog( LOG_INFO, message ); | ||
| 299 | + free( message ); | ||
| 300 | + free( file ); | ||
| 301 | write( fd, lockinfo, 11 ); | ||
| 302 | close( fd ); | ||
| 303 | return 0; | ||
| 304 | @@ -556,7 +560,7 @@ | ||
| 305 | LOCKDIR, NULL | ||
| 306 | }; | ||
| 307 | const char *lockprefixes[] = { "LCK..", "lk..", "LK.", NULL }; | ||
| 308 | - char *p, file[80], pid_buffer[20], message[80]; | ||
| 309 | + char *p, *file, pid_buffer[20], *message; | ||
| 310 | int i = 0, j, k, fd , pid; | ||
| 311 | struct stat buf; | ||
| 312 | struct stat buf2; | ||
| 313 | @@ -595,19 +599,22 @@ | ||
| 314 | while ( lockprefixes[k] ) | ||
| 315 | { | ||
| 316 | /* FHS style */ | ||
| 317 | - sprintf( file, "%s/%s%s", lockdirs[i], | ||
| 318 | + asprintf( &file, "%s/%s%s", lockdirs[i], | ||
| 319 | lockprefixes[k], p ); | ||
| 320 | if( stat( file, &buf ) == 0 ) | ||
| 321 | { | ||
| 322 | - sprintf( message, UNEXPECTED_LOCK_FILE, | ||
| 323 | + asprintf( &message, UNEXPECTED_LOCK_FILE, | ||
| 324 | file ); | ||
| 325 | syslog( LOG_INFO, message ); | ||
| 326 | + free( message ); | ||
| 327 | + free( file ); | ||
| 328 | return 1; | ||
| 329 | } | ||
| 330 | + free( file ); | ||
| 331 | |||
| 332 | /* UUCP style */ | ||
| 333 | stat(port_filename , &buf ); | ||
| 334 | - sprintf( file, "%s/%s%03d.%03d.%03d", | ||
| 335 | + asprintf( &file, "%s/%s%03d.%03d.%03d", | ||
| 336 | lockdirs[i], | ||
| 337 | lockprefixes[k], | ||
| 338 | (int) major( buf.st_dev ), | ||
| 339 | @@ -616,11 +623,14 @@ | ||
| 340 | ); | ||
| 341 | if( stat( file, &buf ) == 0 ) | ||
| 342 | { | ||
| 343 | - sprintf( message, UNEXPECTED_LOCK_FILE, | ||
| 344 | + asprintf( &message, UNEXPECTED_LOCK_FILE, | ||
| 345 | file ); | ||
| 346 | syslog( LOG_INFO, message ); | ||
| 347 | + free( message ); | ||
| 348 | + free( file ); | ||
| 349 | return 1; | ||
| 350 | } | ||
| 351 | + free( file ); | ||
| 352 | k++; | ||
| 353 | } | ||
| 354 | } | ||
| 355 | @@ -644,7 +654,7 @@ | ||
| 356 | #endif /* __unixware__ */ | ||
| 357 | p--; | ||
| 358 | } | ||
| 359 | - sprintf( file, "%s/%s%s", LOCKDIR, LOCKFILEPREFIX, p ); | ||
| 360 | + asprintf( &file, "%s/%s%s", LOCKDIR, LOCKFILEPREFIX, p ); | ||
| 361 | #else | ||
| 362 | /* UUCP standard locks */ | ||
| 363 | if ( stat( port_filename, &buf ) != 0 ) | ||
| 364 | @@ -656,7 +666,7 @@ | ||
| 365 | syslog( LOG_INFO, message ); | ||
| 366 | return 1; | ||
| 367 | } | ||
| 368 | - sprintf( file, "%s/LK.%03d.%03d.%03d", | ||
| 369 | + asprintf( &file, "%s/LK.%03d.%03d.%03d", | ||
| 370 | LOCKDIR, | ||
| 371 | (int) major( buf.st_dev ), | ||
| 372 | (int) major( buf.st_rdev ), | ||
| 373 | @@ -677,10 +687,11 @@ | ||
| 374 | |||
| 375 | if( kill( (pid_t) pid, 0 ) && errno==ESRCH ) | ||
| 376 | { | ||
| 377 | - sprintf( message, | ||
| 378 | + asprintf( &message, | ||
| 379 | "RXTX Warning: Removing stale lock file. %s\n", | ||
| 380 | file ); | ||
| 381 | syslog( LOG_INFO, message ); | ||
| 382 | + free( message ); | ||
| 383 | if( unlink( file ) != 0 ) | ||
| 384 | { | ||
| 385 | snprintf( message, 80, "RXTX Error: Unable to \ | ||
| 386 | @@ -688,10 +699,13 @@ | ||
| 387 | file | ||
| 388 | ); | ||
| 389 | syslog( LOG_INFO, message ); | ||
| 390 | + free( message ); | ||
| 391 | + free( file ); | ||
| 392 | return 1; | ||
| 393 | } | ||
| 394 | } | ||
| 395 | } | ||
| 396 | + free( file ); | ||
| 397 | return 0; | ||
| 398 | } | ||
| 399 | int init( void ) | ||
