Skip to content

Commit eb8905b

Browse files
olafheringgregkh
authored andcommitted
Tools: hv: fix warnings in hv_vss_daemon
This change fixes a few compile errors: hv_vss_daemon.c:64:15: warning: unknown escape sequence '\/' hv_vss_daemon.c:64:15: warning: unknown escape sequence '\/' hv_vss_daemon.c: In function 'vss_operate': hv_vss_daemon.c:66: warning: 'return' with no value, in function returning non-void hv_vss_daemon.c: In function 'main': hv_vss_daemon.c:130: warning: ignoring return value of 'daemon', declared with attribute warn_unused_result hv_vss_daemon.c: In function 'vss_operate': hv_vss_daemon.c:47: warning: 'fs_op' may be used uninitialized in this function Signed-off-by: Olaf Hering <olaf@aepfle.de> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 9809785 commit eb8905b

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

‎tools/hv/hv_vss_daemon.c‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ static int vss_operate(int operation)
5151
FILE *file;
5252
char *p;
5353
char *x;
54-
int error;
54+
int error = 0;
5555

5656
switch (operation) {
5757
case VSS_OP_FREEZE:
@@ -60,11 +60,13 @@ static int vss_operate(int operation)
6060
case VSS_OP_THAW:
6161
fs_op = "-u ";
6262
break;
63+
default:
64+
return -1;
6365
}
6466

65-
file = popen("mount | awk '/^\/dev\// { print $3}'", "r");
67+
file = popen("mount | awk '/^\\/dev\\// { print $3}'", "r");
6668
if (file == NULL)
67-
return;
69+
return -1;
6870

6971
while ((p = fgets(buf, sizeof(buf), file)) != NULL) {
7072
x = strchr(p, '\n');
@@ -128,7 +130,9 @@ int main(void)
128130
int op;
129131
struct hv_vss_msg *vss_msg;
130132

131-
daemon(1, 0);
133+
if (daemon(1, 0))
134+
return 1;
135+
132136
openlog("Hyper-V VSS", 0, LOG_USER);
133137
syslog(LOG_INFO, "VSS starting; pid is:%d", getpid());
134138

0 commit comments

Comments
 (0)