Ensure both logger and syslogd output the same version string
Slight differences in output when called with `-v` flag:
  - Should output to stdout, that's what people expect (not an error)
  - Should output *project* name and version, for syslogd this is not
    so obvious since it *logs* 'syslogd vx.y.z' while the version is
    'sysklogd vx.y.z'
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
			
			
This commit is contained in:
		| @@ -366,7 +366,7 @@ int main(int argc, char *argv[]) | |||||||
| 			break; | 			break; | ||||||
|  |  | ||||||
| 		case 'v':	/* version */ | 		case 'v':	/* version */ | ||||||
| 			fprintf(stderr, "%s\n", version_info); | 			printf("%s\n", version_info); | ||||||
| 			return 0; | 			return 0; | ||||||
|  |  | ||||||
| 		default: | 		default: | ||||||
|   | |||||||
| @@ -107,6 +107,8 @@ static volatile sig_atomic_t debugging_on; | |||||||
| static volatile sig_atomic_t restart; | static volatile sig_atomic_t restart; | ||||||
| static volatile sig_atomic_t rotate_signal; | static volatile sig_atomic_t rotate_signal; | ||||||
|  |  | ||||||
|  | static const char version_info[] = PACKAGE_NAME " v" PACKAGE_VERSION; | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * Intervals at which we flush out "message repeated" messages, |  * Intervals at which we flush out "message repeated" messages, | ||||||
|  * in seconds after previous message is logged.  After each flush, |  * in seconds after previous message is logged.  After each flush, | ||||||
| @@ -494,8 +496,8 @@ int main(int argc, char *argv[]) | |||||||
| 			break; | 			break; | ||||||
|  |  | ||||||
| 		case 'v': | 		case 'v': | ||||||
| 			printf("syslogd v%s\n", VERSION); | 			printf("%s\n", version_info); | ||||||
| 			exit(0); | 			return 0; | ||||||
|  |  | ||||||
| 		case '?': | 		case '?': | ||||||
| 			return usage(0); | 			return usage(0); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user