2021-06-02 Fred Gleason <fredg@paravelsystems.com>

* Cleaned up compile warnings in rddbmgr(8).

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2021-06-02 15:46:39 -04:00
parent ea17c5d8ca
commit 7a6537e2b3
2 changed files with 38 additions and 23 deletions

View File

@ -21840,3 +21840,5 @@
* Cleaned up compile warnings in the 'test_pam' harness. * Cleaned up compile warnings in the 'test_pam' harness.
2021-06-02 Fred Gleason <fredg@paravelsystems.com> 2021-06-02 Fred Gleason <fredg@paravelsystems.com>
* Cleaned up compile warnings in rdalsaconfig(8). * Cleaned up compile warnings in rdalsaconfig(8).
2021-06-02 Fred Gleason <fredg@paravelsystems.com>
* Cleaned up compile warnings in rddbmgr(8).

View File

@ -473,7 +473,8 @@ void MainObject::RelinkCut(const QString &src_filename,const QString &cutname,
} }
else { else {
unlink(RDCut::pathName(cutname).toUtf8()); unlink(RDCut::pathName(cutname).toUtf8());
link((*firstdest).toUtf8(),RDCut::pathName(cutname).toUtf8()); RDCheckExitCode("RelinkCut() link",
link((*firstdest).toUtf8(),RDCut::pathName(cutname).toUtf8()));
} }
} }
else { else {
@ -483,9 +484,12 @@ void MainObject::RelinkCut(const QString &src_filename,const QString &cutname,
} }
} }
else { else {
chown(RDCut::pathName(cutname).toUtf8(),db_config->uid(), RDCheckExitCode("RelinkCut() chown",
db_config->gid()); chown(RDCut::pathName(cutname).toUtf8(),db_config->uid(),
chmod(RDCut::pathName(cutname).toUtf8(),S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP); db_config->gid()));
RDCheckExitCode("RelinkCut() chmod",
chmod(RDCut::pathName(cutname).toUtf8(),
S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP));
} }
} }
else { else {
@ -499,8 +503,10 @@ void MainObject::RelinkCut(const QString &src_filename,const QString &cutname,
} }
} }
else { else {
unlink(RDCut::pathName(cutname).toUtf8()); RDCheckExitCode("RelinkCut() unlink",
link((*firstdest).toUtf8(),RDCut::pathName(cutname).toUtf8()); unlink(RDCut::pathName(cutname).toUtf8()));
RDCheckExitCode("RelinkCut() link",
link((*firstdest).toUtf8(),RDCut::pathName(cutname).toUtf8()));
} }
} }
printf(" done.\n"); printf(" done.\n");
@ -534,7 +540,8 @@ void MainObject::RelinkCast(const QString &src_filename,const QString &keyname,
} }
else { else {
unlink(destpath.toUtf8()); unlink(destpath.toUtf8());
link((*firstdest).toUtf8(),destpath.toUtf8()); RDCheckExitCode("RelinkCast() link",
link((*firstdest).toUtf8(),destpath.toUtf8()));
} }
} }
else { else {
@ -544,13 +551,15 @@ void MainObject::RelinkCast(const QString &src_filename,const QString &keyname,
} }
} }
else { else {
chown(destpath.toUtf8(),db_config->uid(),db_config->gid()); RDCheckExitCode("RelinkCast() chown",
chown(destpath.toUtf8(),db_config->uid(),
db_config->gid()));
chmod(destpath.toUtf8(),S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP); chmod(destpath.toUtf8(),S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
} }
} }
else { else {
if(firstdest->isEmpty()) { if(firstdest->isEmpty()) {
unlink(destpath.toUtf8()); RDCheckExitCode("RelinkCast() unlink",unlink(destpath.toUtf8()));
if(CopyToAudioStore(destpath,src_filename)) { if(CopyToAudioStore(destpath,src_filename)) {
*firstdest=destpath; *firstdest=destpath;
} }
@ -560,8 +569,9 @@ void MainObject::RelinkCast(const QString &src_filename,const QString &keyname,
} }
} }
else { else {
unlink(destpath.toUtf8()); RDCheckExitCode("RelinkCast() unlink",unlink(destpath.toUtf8()));
link((*firstdest).toUtf8(),destpath.toUtf8()); RDCheckExitCode("RelinkCast() link",
link((*firstdest).toUtf8(),destpath.toUtf8()));
} }
} }
printf(" done.\n"); printf(" done.\n");
@ -762,7 +772,9 @@ void MainObject::CheckOrphanedCuts() const
else { else {
printf(" Clear it (y/N)?"); printf(" Clear it (y/N)?");
if(UserResponse()) { if(UserResponse()) {
system(("mv "+file->filePath()+" "+db_dump_cuts_dir+"/").toUtf8()); RDCheckExitCode("CheckOrphanedCuts() system",
system(("mv "+file->filePath()+" "+
db_dump_cuts_dir+"/").toUtf8()));
sql=QString().sprintf("delete from `CUTS` where `CUT_NAME`='%s'", sql=QString().sprintf("delete from `CUTS` where `CUT_NAME`='%s'",
q->value(0).toString().toUtf8().constData()); q->value(0).toString().toUtf8().constData());
q1=new QSqlQuery(sql); q1=new QSqlQuery(sql);
@ -810,12 +822,12 @@ void MainObject::CheckOrphanedAudio() const
printf(" Move to \"%s\" (y/N)? ", printf(" Move to \"%s\" (y/N)? ",
db_dump_cuts_dir.toUtf8().constData()); db_dump_cuts_dir.toUtf8().constData());
if(UserResponse()) { if(UserResponse()) {
system(QString().sprintf("mv %s/%s %s/", RDCheckExitCode("CheckOrphanedAudio() system",
db_config->audioRoot().toUtf8(). system(QString().sprintf("mv %s/%s %s/",
constData(), db_config->audioRoot().toUtf8().constData(),
list.at(i).toUtf8().constData(), list.at(i).toUtf8().constData(),
db_dump_cuts_dir.toUtf8().constData()). db_dump_cuts_dir.toUtf8().constData()).
toUtf8()); toUtf8()));
printf(" Saved audio in \"%s/%s\"\n", printf(" Saved audio in \"%s/%s\"\n",
db_dump_cuts_dir.toUtf8().constData(), db_dump_cuts_dir.toUtf8().constData(),
list.at(i).toUtf8().constData()); list.at(i).toUtf8().constData());
@ -1000,16 +1012,16 @@ bool MainObject::UserResponse() const
return false; return false;
} }
while((c!='y')&&(c!='Y')&&(c!='n')&&(c!='N')) { while((c!='y')&&(c!='Y')&&(c!='n')&&(c!='N')) {
scanf("%c",&c); RDCheckReturnCode("UserResponse()",scanf("%c",&c),1);
if((c=='y')||(c=='Y')) { if((c=='y')||(c=='Y')) {
scanf("%c",&c); RDCheckReturnCode("UserResponse()",scanf("%c",&c),1);
return true; return true;
} }
if(c=='\n') { if(c=='\n') {
return false; return false;
} }
} }
scanf("%c",&c); RDCheckReturnCode("UserResponse()",scanf("%c",&c),1);
return false; return false;
} }
@ -1043,10 +1055,11 @@ bool MainObject::CopyToAudioStore(const QString &destfile,
} }
data=(char *)malloc(blksize); data=(char *)malloc(blksize);
while((n=read(src_fd,data,blksize))!=0) { while((n=read(src_fd,data,blksize))!=0) {
write(dest_fd,data,n); RDCheckReturnCode("CopyToAudioStore() write",write(dest_fd,data,n),n);
} }
free(data); free(data);
fchown(dest_fd,db_config->uid(),db_config->gid()); RDCheckExitCode("CopyToAudioStore() fchown",
fchown(dest_fd,db_config->uid(),db_config->gid()));
fchmod(dest_fd,S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP); fchmod(dest_fd,S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
close(dest_fd); close(dest_fd);
close(src_fd); close(src_fd);