Fix "warning: 'cmd' may be used uninitialized in this function"